Erick Suarez
Erick Suarez

Reputation: 1

MS GRAPH API Upload v1.0 endpoint corrupts DOCX

Was trying to upload docx files through a golang server using MS graph API, and although I was able to upload pdfs, when I tried uploading docx files the files were being corrupted when sent over. If I upload the same file through the OneDrive website, there would be no problems.

To isolate the issue I tried making the API calls through postman using a link like:

https://graph.microsoft.com/v1.0/users/[email protected]/drives/{drive-id}/items/{item-id}:/filename.docx:/content

used a bearer token.

the additional header of Content-Type of which I have tried the values:

text/plain
application/x-www-form-urlencoded
application/vnd.openxmlformats-officedocument.wordprocessingml.document

and uploaded the file with the form-data option under the body tab but with no luck, the file always gets corrupted.

Any ideas?

Upvotes: 0

Views: 423

Answers (1)

Erick Suarez
Erick Suarez

Reputation: 1

[Resolved] Was sending file as form-data instead of binary!

Upvotes: 0

Related Questions