Sureshkumar P
Sureshkumar P

Reputation: 11

Microsoft graph APIs for oneDrive data access is not working with admin consent

Microsoft graph APIs for oneDrive data access is not working while using admin consent method, in the same way, I can able to access mail, contact, and calendar of users of the domain.

We have created an application which is used to backup and restore the user data of the Google domain. With the help of an admin consent option we able to get all users data with the help of graph API, but while accessing oneDrive data of any user is not working. Instead, it's only fetching the admin user oneDrive data.

API : https://graph.microsoft.com/v1.0/me/drive/root

If we are calling like below then not working, basically we need to access all users Onedrive data using admin consent. Also, we gave all permission in our AAD application.

API : https://graph.microsoft.com/v1.0/{user_objectid/email}/drive/root

Help on this issue.

Upvotes: 0

Views: 335

Answers (1)

Seiya Su
Seiya Su

Reputation: 1874

  1. Please check the permission configuration in the Azure App portal.
  2. Check your code, ensure the User Context is right. You always get the data of the admin most likely you use the wrong User Context. You can provide the key code so we can further assist you.
  3. Your api format is wrong.

    https://graph.microsoft.com/v1.0/{user_objectid/email}/drive/root

The right one:

 https://graph.microsoft.com/v1.0/users/{user_objectid/email}/drive/root

Upvotes: 0

Related Questions