Context
When you’re developing line of business applications with Microsoft 365, you probably need to save user settings at some point. You might know or already working with Open extensions (old name is Office 365 data extensions) which provide a great way to store untyped properties to a specific resource (for example the user resource) in Microsoft Graph. In this new article, I’ll show you how to do this by another way with the less-known option OneDrive application’s personal folder and Microsoft Graph. Let’s jump into it now!
Application’s personal folder
Application’s personal folder is part of special folders available in OneDrive/OneDrive for Business and usually stored in /Apps/{ApplicationName} which Microsoft Graph provides a very simple access to it without using any path. One advantage with application’s personal folder is that it’s automatically created if it doesn’t exist!
Create a JSON app configuration file
With OneDrive application’s personal folder, you can easily create and store a JSON app configuration file using Microsoft Graph endpoints depending which permission type you are using in your application:
PUT https://graph.microsoft.com/v1.0/users/{{UserId}}/drive/special/approot:/config.json:/content
PUT https://graph.microsoft.com/v1.0/me/drive/special/approot:/config.json:/content
Note: {{UserId}} is my Postman variable which contains my user ID and needs to be replaced by the current user ID or UPN in your line of business application if you are using the Application permission type.
Then add the JSON content representing your user settings in the request body, for example:
{
"StartPage": "MyAgenda",
"MyAgendaDaysAhead": "5"
}
As best practice, don’t forget to add the following header in your request:
Content-Type: application/json
After executing the query on Microsoft Graph endpoint, response body will contains a summary of file created with all properties. Now if you look at user’s drive you should see something like this:

Note: Postman is the display name of the app registration in Azure Active Directory. In SPFx developement context, app folder name will be SharePoint Online Client Extensibility Web Application Principal which represents the SharePoint Online service principal display name in your Microsoft 365 tenant. As SPFx solutions will share the same root app folder, you should consider creating a subfolder for each individual solution you’re developing.
Read a JSON app configuration file
Now we have a proper JSON app configuration file created in the user’s drive, we can read it easily using the same endpoints as before but using a GET method this time:
GET https://graph.microsoft.com/v1.0/users/{{UserId}}/drive/special/approot:/config.json:/content
GET https://graph.microsoft.com/v1.0/me/drive/special/approot:/config.json:/content
After executing the query without any error, you should be able to see the final in response body as below:
{
"StartPage": "MyAgenda",
"MyAgendaDaysAhead": "5"
}
Update a JSON app configuration file
Updating the JSON app configuration file is the same process as create previously but keep in mind that you have a to store a living copy of user settings in your application local storage and update the app configuration file in OneDrive when user settings changed in your line of business application (for example with a listener).
Common use cases
I’m sure you’ll find a lot of common use cases for OneDrive application’s personal folder but on my side I’m using it in SPFx web part development (in the past common way was to use User Profile Service or custom list), Microsoft Teams app development or .NET Core development especially when you want to keep user settings between the desktop and web client of your line of business application for example. The only problem I see with this method compared to Open extensions is when the user accidentally deletes the Apps folder in his drive… Your line of business application needs to check at startup if the folder exists and if not then creating a fresh app configuration file with default values or when user settings changed to recreate the app configuration file with the right local application context to keep it working well. One key point in your line of business app will be to manage user settings lifecycle between local and OneDrive context so be careful with that topic.
Don’t hesitate to tell me what you think about Open extensions vs OneDrive application’s personal folder for saving user settings 😉
Happy coding everyone!
Resources
https://docs.microsoft.com/en-us/graph/overview
https://docs.microsoft.com/en-us/graph/api/drive-get-specialfolder
https://docs.microsoft.com/en-us/graph/api/resources/onedrive
https://docs.microsoft.com/en-us/graph/api/resources/opentypeextension