Microsoft Graph API | Chunk upload with Postman

Andrin 26 Reputation points
2021-10-05T13:06:12.43+00:00

Hello Together

I have a problem that involves uploading chunks with Microsoft Graph API From Postman to Sharepoint.

What am I trying to do:
I am trying to upload a TextFile with a size of 808 bytes to the sharepoint using Postman.
I know that you can upload a file of this size as a whole, but for files larger than 60 MB I have to use the method with the chunks.

  1. Step
    POST https://graph.microsoft.com/v1.0/sites/siteId/drives/driveId/root:/Folder/aaafilename.txt:/createUploadSession
  2. Step
    PUT UploadLink
    Content-Length = 404
    Content-Range = bytes 0-403/808
    In Body I choose binary and upload my file.
  3. Step
    PUT UploadLink
    Content-Length = 404
    Content-Range = bytes 404-807/808
    In Body I choose binary and upload my file.

Result I get:
The file can be found in the sharepoint under the name "aaafilename.txt", but the content is wrong.

The File I uploaded:
137700-2021-10-05-15-01-29-unbenannt-editor.png

The file I find on the sharepoint:
137729-2021-10-05-15-03-03-unbenannt-editor.png

I would really appreciate your help

Greetings

Andrin

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,396 questions
0 comments No comments
{count} vote

Accepted answer
  1. Srinivasa Rao Darna 6,711 Reputation points Microsoft Vendor
    2022-03-10T16:08:30.537+00:00

    Hi @Andrin ,

    As per the documentation you can upload 60MiB, as you are trying to upload a very small file of 808 bytes, request you to upload at one go using createUploadSession or use simple upload API.

    Soure: driveitem-createuploadsession

    It is recommended to Use resumable file transfers for files larger than 10 MiB (10,485,760 bytes), and files smaller than 10MiB can be uploaded at one by passing the entire content-range.

    Also, there appears to be limitation with files smaller than 4MB using createUploadSession when split into multiple chunks.
    Refer: Upload file using upload session break some content.

    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 additional answers

Sort by: Most helpful