question

SachinKumar-0345 avatar image
0 Votes"
SachinKumar-0345 asked CarlZhao-MSFT commented

Microsoft Graph api for onedrive upload file uploads file metadata by default

Hi

I need to upload only contents of the file without metadata. Tried different ways of calling the api it always puts the metadata ( headers - Content-Type: application/json Content-Disposition and file name ) are getting added as part of the file.

api is - /me/drive/root:/FolderA/FileB.txt:/content

microsoft-graph-filesmicrosoft-graph-applications
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

CarlZhao-MSFT avatar image
0 Votes"
CarlZhao-MSFT answered CarlZhao-MSFT edited

I tried to call the api to upload the text, but it did not upload the metadata to the file content. I tested it locally and there should be no problem. Can you tell me your operation process? This is my test result:

132168-image.png

132318-301.png



Update:

It has been confirmed that this is by design. When you upload a file in onedrive/sharepoint it adds the metadata - by default.






image.png (46.5 KiB)
301.png (7.2 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SachinKumar-0345 avatar image
0 Votes"
SachinKumar-0345 answered CarlZhao-MSFT commented

This UI works fine as we put the contents of the file in the request body. In our case we are trying to upload a file from postman and we provide Multipart/forma-data as content-type and upload the file directly then it adds the metadata along with content to the uploaded file.

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It has been confirmed that this is by design.

0 Votes 0 ·

If an Answer is helpful, please click "Accept Answer" and upvote it.

0 Votes 0 ·