Unable to Access Shared File via Graph API Endpoint

Waqar Farooqui 0 Reputation points
2023-11-27T05:23:30.94+00:00

Hello Microsoft,

I am encountering an error while attempting to access a shared file through the graphapi endpoint. The Shared with Me API is expected to provide a list of all files and folders shared by both internal and external users. However, when I try to access a file shared with full access by another user, the graphapi returns the following error:
I am unable to access the the shared files and folder by using graph api could you change the access permission.

Query Details:
Error: 404 - {"error":{"code":"itemNotFound","message":"The resource could not be found.","innerError":{"date":"2023-11-24T03:30:07","request-id":"e4990ef3-be58-4e60-a86a-19e6dc1d2543","client-request-id":"e4990ef3-be58-4e60-a86a-19e6dc1d2543"}}}

Please conside my request Microsoft

Thank you,

Waqar Farooqui

OneNote
OneNote
A family of Microsoft products that enable users to capture, organize, and reuse notes electronically.
177 questions
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,269 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
944 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
7,294 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 39,736 Reputation points
    2023-11-27T06:27:50.1+00:00

    Hi @Waqar Farooqui

    Please make sure that the permission you grant is one of the *.All permissions, otherwise you will not be able to access shared items returned from this API.

    User's image

    By default, this API returns items shared within your own tenant. To include items shared from external tenants, append ?allowexternal=true to a GET request.

    GET https://graph.microsoft.com/v1.0/me/drive/sharedWithMe?allowexternal=true
    

    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.