Adding custom data to users using Microsoft Graph extensions part 1

Reading Time: 2 minutes

Many business scenarios of custom solutions require storing custom user data, imagine for example, when you want to save the preferred language of a user, the theme or which links to display in the UI, in conclusion, preferences of the user.
In the SharePoint conference North America 2018 Microsoft has presented a real use case in SharePoint online across a SharePoint Framework extension deployed tenant-wide, it means available to the entire tenant, in the footer which allows the user to save in the user profile the favorites links.
Microsoft across the efforts of the community has also released on its Github a starter kit of a solution which contains the sample that I mentioned above, feel free to install it on your Office 365 tenant.
These kinds of use cases where a requirement is to save the preferences into the user profile can be covered by leveraging the capabilities of Microsoft Graph Extensions, there are two types of extensions in this article the focus is on open extensions.
The open extensions allow saving untyped data, which is definitely a good option if you need flexibility.
Let’s start to create an open extension, in order to do that you can open the Graph Explorer, click on show more example and then enable extensions, here how looks like:

Graph Explorer | Giuliano De Luca
Microsoft Graph Explorer

Create an Open Extension

Across this POST request you can save for the current user custom data which are in this example:

I’m going to save the theme, color and language for the current user that I can use in the next time for my custom solution.
Naturally you are able to perform the CRUD operations, it means that you can also read the open extension just saved, with the URL that will be:

and the response:

There is the possibility to save open extensions for administrativeUnit, device, group, organization or user.
You need to keep in mind when you are designing the solution, that, there are also limitations.

Read here the next article about open extensions:
Adding custom data to users using Microsoft Graph extensions part 2

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