Share via

MS Graph extensionProperties

Patrice Côté 186 Reputation points
2021-12-03T20:51:55.483+00:00

I have added some custom properties as extendedProperties in MS Graph following the Microsoft documentation here.

I first created it with a POST query :

POST "https://graph.microsoft.com/v1.0/applications/{b2c-extensions-app_objectId}/extensionProperties"
{
"name": "requiresMigration",
"dataType": "Boolean",
"targetObjects": ["User"]
}

I then updated a user (PATCH query) to add it like so :

PATCH "https://graph.microsoft.com/v1.0/users/{my-user-id}
{
"extension_{b2c-extensions-app_applicationId}_requiresMigration": true
}"

In AAD B2C, my custom policy is able to retreive those claims and send them back in the identity token, no problem. But in MS Graph, there is no way I can see it? I tried like defined in the documentation (https://graph.microsoft.com/v1.0/users/{my-user-id})/extensionProperties) but it didn't work. Can anyone tell me how can I retreive the users WITH these custom extension properties please?

**NOTE that we didn't use open or schema extensions for this, we used extensionProperties. This was in a migration scenario that I followed.

Microsoft Security | Microsoft Entra | Microsoft Entra External ID
Microsoft Security | Microsoft Graph
0 comments No comments

Answer accepted by question author

AmanpreetSingh-MSFT 56,971 Reputation points Moderator
2021-12-06T05:11:27.21+00:00

Hi @Patrice Côté • Thank you for reaching out.

If you use the GET call https://graph.microsoft.com/v1.0/users/{user-id}, it will only return a subset of the properties for the given user, which does not include the extension properties. In order to get the extension properties, you need to specify the extension attribute name using the $select parameter, as mentioned below:

GET https://graph.microsoft.com/v1.0/users/{user-id}?$select=extension_b2c-extensions-appId_requiresMigration  

You may also consider using the beta endpoint if you do not want to use the $select parameter.

GET https://graph.microsoft.com/beta/users/{user-id}  

This call will return all the attributes of the given user including the extension attributes.

-----------------------------------------------------------------------------------------------------------

Please "Accept the answer" if the information helped you. This will help us and others in the community as well.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.