使用 Microsoft 图形 API 检索特定属性 [英] Using Microsoft graph API to retrieve a specific attribute

查看:14
本文介绍了使用 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 graph explorer 进行一些测试,但是我不完全确定如何检索名为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.

推荐答案

如果您查看 记录在用户身上的属性,你会发现没有名为EmployeeId的属性.

If you look at the documented properties exposed on a user, you will find there is no property called EmployeeId.

现在这个属性可能以 在用户对象上打开扩展.

Now it could be that this property exists as an Open Extension on the user object.

在这种情况下,您可以阅读此处 关于如何返回用户对象的扩展属性.

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.

我希望这会有所帮助.

这篇关于使用 Microsoft 图形 API 检索特定属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆