Graph API - upload zip file

Shadi Rashed 71 Reputation points
2022-05-09T08:37:04.773+00:00

Hello,
I am trying to use this endpoint to upload a small zip file to my Document Library in Sharepoint https://learn.microsoft.com/en-us/graph/api/driveitem-put-content?view=graph-rest-1.0&tabs=http
/drives/{drive-id}/items/{parent-id}:/{filename}:/content

The file gets uploaded fine, however, when I then download the file to my local machine it does not get recognized as a zip file. I am uploading the file with the filename "test.zip" and using the Content-Type Header "application/zip". Is there anything else that I need to be aware of for uploading more complex files than just simple texts?

Unfortunately the documentation only gives examples for writing some text to a file.

Many Thanks!
Shadi

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Zehui Yao_MSFT 5,876 Reputation points
    2022-05-09T09:36:52.17+00:00

    Hello anonymous userRashed-1057, I test with API PUT /drives/{drives-id}/root:/MyFolder/MyFile.txt:/content. And both upload and download work fine. Please try to do the same in postman and check the result.
    200223-image.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.

    1 person found this answer 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.