Access another user's drive information using APIs.

Rajan Radhe 0 Reputation points
2023-01-16T08:14:57.4533333+00:00

I want to know, can I access another oneDrive user profile or not using APIs with the same access token?

If yes so how can I achieve this by using Microsoft APIs?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,253 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
939 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Shivam Dhiman 5,951 Reputation points
    2023-01-17T00:35:42.2533333+00:00

    Hi @Rajan Radhe

    If you are looking to access other users drive in your tenant using Microsoft Graph API, you can use this GET https://graph.microsoft.com/v1.0/users/{user-id}/drive Graph API endpoint.
    If you are using **client_credentials flow **you need these Permissions (from least to most privileged) Files.Read.All, Files.ReadWrite.All, Sites.Read.All, Sites.ReadWrite.All.

    If you are using Authorization_code(delegated Permission), users OneDrive is needed to be shared with you which can be done by Global Admin (Admin Center->Active Users->User->OneDrive->Get access to file) or User can share his drive from Site Collection Administrators as shown below screenshot: Untitled11111

    Please provide the required permission and use the Graph API.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments