Unable to get files/folders from OneDrive using sharedWithMe graph API

Sagar Gole 0 Reputation points
2024-07-10T15:49:51.1966667+00:00

How can I retrieve OneDrive files and folders for the drive using sharedWithMe API? I have already configured all the necessary permissions for the application, but the API is returning an empty response.

These are the configured permissions:

User's image

This is the code I am using to call the API:

SharedWithMeGetResponse sharedWithMe  = graphClient.drives().byDriveId(d.getId()).sharedWithMe().get();
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,199 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,136 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 42,051 Reputation points
    2024-07-11T07:35:19.2933333+00:00

    Hi @Sagar Gole

    It works fine for me, try logging in your user to Graph Explorer and calling this endpoint to see if it returns the files shared with you correctly.

    User's image

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.