使用Microsoft图形API检索特定属性
嗨(我是新来的,所以您需要原谅我),
Hi (i'm new to this so you'll need to forgive me),
我正在尝试使用Microsoft Graph API从活动目录中检索一些用户属性.
I'm trying to use Microsoft Graph API to retrieve some user attributes from active directory.
我正在 Microsoft图形浏览器上进行一些测试,但是我不完全确定如何检索称为employeeID的特定属性(这是必需的).我发现了如何使用以下方法检索我需要的其他一些基本信息:
I'm conducting some testing on Microsoft graph explorer but i'm not entirely sure how to retrive a specific attribute called employeeID (which is needed). I've found out how to retrive some of the other basic information i need using the following:
https://graph.microsoft.com/v1.0/me
哪个返回:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"id": "6df92a63-2bef-477c-8c84-bf1113d5bd3e",
"businessPhones": [],
"displayName": "SmithB",
"givenName": "bob",
"jobTitle": null,
"mail": "example@example.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": "smith",
"userPrincipalName": "example@example.com"
}
但是,我不知所措.文档似乎提到了有关使用$select
的内容,但似乎更多的是完善查询而不是查找特定属性.
However, i'm at a loss beyond this point. The docs seem to mention something about using $select
but it seems to be more for refining a query rather than finding a specific attribute.
我敢肯定有一个相当简单的解决方案,如果有人能为我指出正确查询特定属性的正确方向,我将不胜感激.
I'm sure there is a fairly simple solution and would appreciate if someone could point me in the right direction for how to query a specific attribute.
If you look at the documented properties exposed on a user, you will find there is no property called EmployeeId
.
现在此属性可能以在用户对象上打开扩展.
在这种情况下,您可以在此处阅读关于如何返回用户对象的扩展属性.
In that case you can read here on how to return the extension properties for the user object.
GET /users/{Id|userPrincipalName}/extensions/{extensionId}
或者您可以使用架构扩展出于相同的目的.
Or you could be using Schema Extensions for the same purpose.
GET https://graph.microsoft.com/beta/schemaExtensions
无论哪种方式,如果您确定目录中存在EmployeeId
,则应该知道它不是Microsoft Graph或AAD支持的默认属性.相反,它必须是使用上述两种扩展方法之一添加到您目录中的某些扩展名.
Either way, if you are certian that EmployeeId
exists in your directory, you should know it is NOT a default property that is supported by Microsoft Graph or AAD. Instead it must be some extension that was added to your directory with one of the two extension methods above.
我希望这会有所帮助.