OneDrive - graph api to get files shared with a user

Sushama Shroff (sushroff) 5 Reputation points
2024-02-26T06:34:15.3633333+00:00

What is the graph Api to get the files shared with user for OneDrive ? (using the below auth flow) I am using an Azure Add App and the client credential flow with a self signed certificate as below. Using this, and the graph Apis, I am able to get the drive items for the user under the root drive alone. This doe not show me any items that have been shared with a user, that are not under the root drive.

authority = 'https://login.microsoftonline.com/' + tenant_id
scope = ['https://graph.microsoft.com/.default']
app = msal.ConfidentialClientApplication(client_id,                                         authority=authority,                                         client_credential={"thumbprint": thumbprint, "private_key": cert})
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,254 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
939 questions
0 comments No comments
{count} vote

3 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 39,656 Reputation points
    2024-02-26T08:21:07.2233333+00:00

    Hi @Sushama Shroff (sushroff)

    You can try calling the GET /me/drive/sharedWithMe API to get a list of driveItem objects shared with the drive owner. However, this endpoint does not yet support application permissions, you need to create a delegated context.

    Hope this helps.

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

    1 person found this answer helpful.

  2. PDPL 5 Reputation points
    2024-05-28T11:08:15.5+00:00

    Hello,

    I have same situation here, any solutions?

    0 comments No comments

  3. Ciaran 6 Reputation points
    2024-06-10T12:25:03.9266667+00:00

    Sorry. Posted in error

    0 comments No comments