Are there Graph APIs for Uploading/Downloading Documents to/from Sharepoint site

Patil, Vinod V 40 Reputation points
2023-01-27T21:50:55.48+00:00

Do we have Microsoft graph APIs to upload and download documents to and from Sharepoint folders? Please provide those and any link to get details.

Thanks.

Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Answer accepted by question author
  1. Shivam Dhiman 6,086 Reputation points
    2023-01-27T22:49:18.0566667+00:00

    Hi @Patil, Vinod V

    To upload file in SharePoint folder, use this Graph API endpoint.

    PUT /sites/{site-id}/drive/items/{parent-id}:/{filename}:/content

    Please refer to this documentation for more details.
    To upload bigger file please follow this documentation.

    To download file from SharePoint, use this Graph API endpoint.
    GET /sites/{siteId}/drive/root/children

    The above endpoint will give you all files in your sites drive. Use the id of the file which you want to download.

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

    The above endpoint will give you download URL which you can use to download that file.
    Also, you can use GET /sites/{siteId}/drive/items/{item-id}/content endpoint to get the raw content of file.
    Please refer to this documentation for more details

    Hope this helps.

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


1 additional answer

Sort by: Most helpful
  1. Patil, Vinod V 40 Reputation points
    2023-02-02T21:35:01.21+00:00

    Thanks Dhiman, Tong.

    I am able to upload a file to sharepoint using PUT but it doesn't show the file in the folder on sharepoint. When I use POST using COPY uri and create another copy of the file, it shows that copy in the folder but not the original created. What could be the issue?

    Thanks.

    0 comments No comments

Your answer

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