"Item not found" while trying to read a file from sharepoint using MS Graph API

Kompal Sithta 71 Reputation points
2023-04-05T06:13:13.3466667+00:00

I am trying to read the contents of a file present in a folder of a site in sharepoint using MS graph API. When I am trying to read a file which is direct present on the site I am able to read it but unable to read the file which is present inside a folder on sharepoint. For that I am receiving an error - Item not found. The end point url that I have been using so far is - https://graph.microsoft.com/v1.0/sites/{site-id}/drive/root:/{site-name}/{folder-name}/{file-name}:/content Thanks, Kompal

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
13,282 questions
SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
11,230 questions
0 comments No comments
{count} votes

Accepted answer
  1. RaytheonXie_MSFT 39,761 Reputation points Microsoft External Staff
    2023-04-05T08:10:43.9233333+00:00

    Hi @Kompal Sithta Using driveitem-get-content, you get the content of the file.

    GET /sites/{siteId}/drive/items/{item-id}/content
    
    

    202280-850748-0.png

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

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.