Call the OneDrive API to upload a file without knowing its total size, such as a streaming file

d d 80 Reputation points
2024-12-16T05:50:04.9766667+00:00

Call the OneDrive API to upload a file without knowing its total size, such as a streaming file, which OneDrive API supports this feature?

RFC7233 describes this situation:

6

GoogleDrive's API supports this feature, please refer to the following link: https://developers.google.com/drive/api/guides/manage-uploads#resumable

7

Does OneDrive API supports similar feature? Which API should be called?

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,882 questions
OneDrive
OneDrive
A Microsoft file hosting and synchronization service.
1,279 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Saranya Madhu-MSFT 1,245 Reputation points Microsoft Vendor
    2025-01-24T06:31:51.2966667+00:00

    Hi d d ,

    Thanks for reaching out to Microsoft!

    As per Microsoft documentation, Graph API can be used to upload files up to the maximum files size using create upload session which allows your app to upload range of the file in sequential API requests.

    To upload a file using an upload session, there are two steps:

    Create an upload session

    Upload bytes to the upload session

    You can upload the entire file, or split the file into multiple byte ranges, as long as the maximum bytes in any given request is less than 60 MiB.

    The fragments of the file must be uploaded sequentially in order. Uploading fragments out of order will result in an error.

    Note: If your app splits a file into multiple byte ranges, the size of each byte range MUST be a multiple of 320 KiB (327,680 bytes). Using a fragment size that does not divide evenly by 320 KiB will result in errors committing some files.

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

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.