12

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.

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}

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

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

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.

J Lauzon
  • 141
  • 1
  • 2
  • 6

1 Answers1

10

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"
    }
]

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)

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • Thanks for the answer... I have tried querying the extensions property (and expanding it) however all that is returned is an empty list. The extensions on my User objects were not created with Graph as openExtensions. They were created as extended properties with Azure AD Graph API. I am not sure if those two things are equivalent. – J Lauzon Aug 28 '17 at 20:06
  • There are "open" and "schema" extensions. It sounds like this was a schema extension? You can look up the list of extensions using `https://graph.microsoft.com/v1.0/schemaExtensions`. You can then use the `id` property in `$select=id,name,{schemaExtension-id}` to include it in the results. – Marc LaFleur Aug 28 '17 at 21:12
  • I do not see my extension in schema extensions either. Is it possible that, because they were created with the AAD API, they would not show up? I found a very similar unanswered question here: https://stackoverflow.com/questions/40218848/access-azue-active-directory-extension-from-microsoft-graph. Using this could I would be able to get my extensions. – J Lauzon Aug 28 '17 at 22:21
  • 1
    Thanks for reporting this. You should be able to query v1 AAD Directory Schema Extensions through Microsoft Graph. I'm able to do this in the Microsoft tenant for extensions created through AD Connect, but see multiple reports that others are not able to do this. @JLauzon your $select statement *should* work. Can you update your question with a client request id and timestamp so that we can investigate further please? – Dan Kershaw - MSFT Aug 29 '17 at 01:23
  • Thanks for the reply. I went to make the $select request again through Graph Explorer to get a new request-id and it just worked this time. I am sure that yesterday it was not working so maybe something happened over night to fix the issue. If I run into the issue again, I will be sure to let you know. Thanks again for the help. – J Lauzon Aug 29 '17 at 17:42
  • Thanks for verifying and getting back. Pleased to hear this is now working. Let us know if you see any other issues here. – Dan Kershaw - MSFT Sep 02 '17 at 00:51