0
votes

I registered my application in Application Registration Portal and set the application permissions in Microsoft Graph Permissions to acquire Files.ReadWrite.All (Admin Only). So that I can gain access to all users in the organization using admin consent.

With the token I acquired, I am able to call API endpoints without any problem.

Then I tried to access the approot for a specific user. I sent the GET request to

https://graph.microsoft.com/v1.0/users/{UPN}/drive/special/approot

As per the documentation, when I call the endpoint, it should create a folder inside the Apps folder in users OneDrive, with the name of my application as I registered it in App Registration Portal.

The problem is that the folder created has the name as "Microsoft Graph" instead of my application name.

How can I create the app folder with my application's name?

1

1 Answers

1
votes

You need to request Files.ReadWrite.AppFolder. From the documentation:

The App Folder is a dedicated, special folder for your app. The App Folder is typically named after your app, and is found in the Apps folder in the user's OneDrive. If you request the Files.ReadWrite.AppFolder permission scope and the user authorizes it, your app gets read and write access to this folder.

It is also worth note Files.ReadWrite.AppFolder is only applicable to Personal accounts (OneDrive), it does not work for Work/School accounts (OneDrive for Business). From the Permissions documentation:

The Files.ReadWrite.AppFolder delegated permission is only valid for personal accounts and is used for accessing the App Root special folder with the OneDrive Get special folder Microsoft Graph API.

As aside, the docs here are admittedly confusing and sometimes seem to contradict themselves. I've opened an issue in the documentation repo to see if the topic of permission could be addressed better.