question

GopiRadhika-0333 avatar image
0 Votes"
GopiRadhika-0333 asked saldana-msft edited

Upload a large excel file using createuploadsession Graph API

Hi @MichaelHan-MSFT,
I am trying to upload a large excel file using the createuploadsession option in Graph API via Postman. Below are the settings that I selected:

URL: https://graph.microsoft.com/v1.0/sites/<siteID>tenantID>/drive/root/test/testing.xlsx:/createUploadSession

105593-image.png





I get the success message but no Upload URL is returned. May I know if I am missing something or any details are incorrect? Also can you tell where I should specify the drive file name(source file) and the Sharepoint filename(destination file)?

office-sharepoint-onlineoffice-excel-itpromicrosoft-graph-sdk
image.png (79.4 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.

MichaelHan-MSFT avatar image
1 Vote"
MichaelHan-MSFT answered MichaelHan-MSFT edited

Hi @GopiRadhika-0333,

The createuploadsession request doesn't require file in the body, just choose none for the request. We would get the upload URL in the response body. As the below picture shows.

 POST https://graph.microsoft.com/v1.0/sites/{siteID}/drive/root:/test/testing.xlsx:/createUploadSession

105609-image.png

Then we could use the Upload URL to upload the large file.

 put {upload URL returned}

In the body, choose the file. ThenAdd two headers Content-Length and Content-Range for the request.

Content-Length : {fileSize in bytes}
Content-Range: bytes 0-{fileSize-1}/{fileSize}

For example:

105634-image.png
105559-image.png


If an Answer is helpful, please click "Accept Answer" and upvote it.
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.



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



image.png (109.2 KiB)
image.png (22.1 KiB)
image.png (24.5 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.

GopiRadhika-0333 avatar image
0 Votes"
GopiRadhika-0333 answered

It worked. Thanks for the answer.

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.