使用Microsoft Graph在用户上获取扩展属性 [英] Get Extended Properties on User using Microsoft Graph

查看:67
本文介绍了使用Microsoft Graph在用户上获取扩展属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在与Microsoft Graph一起管理Azure AD用户,并且在访问User对象上的扩展属性时遇到一些麻烦.使用Azure AD Graph API创建用户时添加了该属性,并且如果使用Azure AD API查询用户,则扩展属性将自动返回,名称为"extension_ {appId} _ {propertyName}".我想使用Microsoft Graph访问此属性的值,但没有找到正确的调用.

I am working with Microsoft Graph to manage Azure AD users and am having some trouble accessing extension properties on a User object. The property was added when the user was created using Azure AD Graph API and if you query the user using Azure AD API the extension property is automatically returned with the name "extension_{appId}_{propertyName}". I would like to access the value of this property using Microsoft Graph but haven’t found the correct call to do so.

我尝试使用$ select直接选择属性(通过上面列出的全名)和简称.
https://graph.microsoft.com/beta/Users/{id}?$ select = extension_ {appId} _ {propertyName}

I have tried using $select to select the property directly (by the full name listed above) and the shorter name.
https://graph.microsoft.com/beta/Users/{id}?$select=extension_{appId}_{propertyName}

我还尝试使用$ expand查询singleValueExtendedProperty(和multiValue),但被告知该属性在User对象上不存在.
https://graph.microsoft.com/beta/Users/{id}?$ expand = singleValueExtendedProperty

I have also tried querying the singleValueExtendedProperty (and multiValue) with $expand but am told the property does not exist on a User object.
https://graph.microsoft.com/beta/Users/{id}?$expand=singleValueExtendedProperty

我也尝试过User对象上的'extensions'字段,但这始终只是null.

I have also played around with the 'extensions' field on the User object but that is always just null.

很好奇Graph是否支持此操作,如果支持,如何查询该字段.如果在查询用户组时无需运行单独的查询就可以得到此扩展的值,那将是一个好处.

Just curious if Graph supports this operation and if so, how to query that field. It would be a bonus if I could get the value of this extension when querying for groups of users without having to run a separate query.

推荐答案

扩展名显示在Microsoft Graph的 Extensions 集合内,不是顶级属性:

Extensions show up in Microsoft Graph within the Extensions collection, not are top-level properties:

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(id,displayName,mail,extensions)/$entity",
"id": "16f5a7b6-5a15-4568-aa5a-31bb117e9967",
"displayName": "Anne Weiler",
"mail": "annew@CIE493742.onmicrosoft.com",
"extensions@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('16f5a7b6-5a15-4568-aa5a-31bb117e9967')/extensions",
"extensions": [
    {
        "@odata.type": "#microsoft.graph.openTypeExtension",
        "theme": "dark",
        "color": "purple",
        "lang": "Japanese",
        "extensionName": "com.contoso.roamingSettings",
        "id": "com.contoso.roamingSettings"
    }
]

例如,您可以使用以下查询返回 users (包括任何扩展名)的集合: v1.0/users?$ select = id,displayName,mail& $expand = extensions (请参见

For example, you can use the following query to return a collection of users (including any extensions): v1.0/users?$select=id,displayName,mail&$expand=extensions (see in Graph Explorer)

这篇关于使用Microsoft Graph在用户上获取扩展属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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