HI, How do I download a csv file from Sharepoint site using MS Graph API ?

Akhil Ravindran 1 Reputation point
2022-01-14T12:16:37.21+00:00

HI, I am trying to download a file from a SharePoint Site, but cant find the item-id as listed in the REST API.

Microsoft Security | Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,876 Reputation points
    2022-01-17T08:58:06.23+00:00

    Hello @Akhil Ravindran , this request is available to you : GET /sites/{siteId}/drive/items/{item-id}/content and you can use this link as a reference: https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http


    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.


  2. Srinivasa Rao Darna 6,761 Reputation points Microsoft External Staff
    2022-02-11T18:06:36.487+00:00

    Hello @Akhil Ravindran ,

    As I see from the question are you referring to SharePoint REST API(working-with-lists-and-list-items-with-rest)!
    SharePoint REST API item-id is different and Microsoft Graph API drive item-id is different.

    Use driveitem-list-children API to get drive-items item-id, for my example I am simply getting the children from root folder.

    GET /sites/{id}/drive/root/children  
    

    173672-image001.jpg
    From the above response, take the id of .CSV file which needs to be downloaded.
    Use the driveitem-get-content by making use of the id from above response.

    GET /sites/{id}/drive/items/{id}/content  
    

    173673-image002.jpg
    As I am using postman for this test, I can use Save Response to a file which will download the .CSV file.
    Hope this helps.
    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    0 comments No comments

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.