Adding custom data to users using Microsoft Graph extensions part 2
In the previous article I talked about the Microsoft Graph open extensions, in this second part I’ll write on schema extensions, which as you can presume, are different. The schema extensions give you the ability to extend an entity like administrativeUnit, device, event, message, organization, post, and user with new properties. Once you created schema extensions the status will be “InDevelopment”, this means that can be used only by the App which has it generated.
The reason for that is to give possibility don’t share this custom data with other applications. When the schema extensions are ready to go you have to update the status in “Available”, in order to make discoverable by other apps. It’s possible to use also the Microsoft Graph Explorer to create schema extensions but you have to specify a valid appid, registered in your Office 365 Azure Active Directory in the property “owner”.
Register a schema extension
The first thing to do is to register the schema extension, in my case I want to extend the Group and User with a new property “responsibility”, as I mentioned above I need to specify the owner which is the guid of an App that is correctly registered, in fact, without that, my request will fail. Here below my http POST request how looks like:
I defined the owner, targetTypes User, Group and finally the property responsibility which is a string, as you can see the status at the beginning will be InDevelopment.
Turn the status in Available
Now that my schema extensions is created I’ll change the status, in order to do this I have to use the id of my extension that I received in the response of my first request:
Using schema extensions just created
It’s time to fill out the new property “responsibility“ available for User and Group with the value Office 365, to reach this goal I’ll create a new user:
Reading schema extensions created
Let’s see how to get the new property filled out before when I created a new user:
Read here the previous article about open extensions: Adding custom data to users using Microsoft Graph extensions part 1
If you are interested in Microsoft Graph maybe could be helpful also this article: Displaying and updating your Office 365 profile picture with Microsoft Graph API