Naresh Kumar
Naresh Kumar

Reputation: 21

Can not access other OneDrive Details in MS graph API

I am trying to access users OneDrive details for particular tenant. I have used https://graph.microsoft.com/v1.0/users/{userid}/drives to get drive details. But it is returning data for admin user who is generated application ID in Azure Directory.

Going forward, I need to iterate drive items (https://graph.microsoft.com/v1.0/users/{userId}/drives/{driveId}/list/items) and items permission (https://graph.microsoft.com/v1.0/users/{userId}/drives/{driveId}/list/items/{itemId}/driveItem/permissions). But i stuck at fetching drive details itself.

I have given the Application permission as,

Files.Read.All - Read files in all site collection

Response header i am getting,

**content-type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8
cache-control: private
client-request-id: f612b993-7a31-4171-8feb-8f4ee1f6564b
request-id: f612b993-7a31-4171-8feb-8f4ee1f6564b**

Response Preview:

**{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#drives",
    "value": []
}**

Please suggest if i missing anything to get users onedrive details.

Thanks in advance.

Upvotes: 2

Views: 681

Answers (1)

Seiya Su
Seiya Su

Reputation: 1874

One of the following permissions is required to call this API. You need to confirm you have set the Sites.Read.All and Sites.ReadWrite.All. Common admin account will be work account but not the personal Microsoft account, just Files.Read.All is not enough.

enter image description here

Upvotes: 2

Related Questions