OneDrive File Issues

How to Detect an In-Progress OneDrive Upload Through Microsoft Graph

Muhammad TalhaMuhammad Talha Nov 2, 2026 869 views

Question details

The user needs a reliable method to determine if a file is still actively uploading to OneDrive when querying items via the Microsoft Graph API, as in-progress uploads can misleadingly return a size of 0 bytes.

How to Detect an In-Progress OneDrive Upload Through Microsoft Graph
Product
Microsoft Graph API
Device & OS
not provided
Scenario
Querying OneDrive drive items via Microsoft Graph while a large file (e.g., an Ubuntu image) is actively uploading to the server.
Observed behavior
The get-items request returns the drive item with a size of 0 bytes while it is still uploading, making the file falsely appear as empty or corrupted rather than incomplete.
Before you start

Ensure you have an active Microsoft Graph access token with the appropriate Files.ReadWrite permissions to query OneDrive items and upload sessions.

Solution 1Recommended

Utilize the Upload Session Workflow for Resumable Uploads

The most reliable way to monitor an in-progress upload is by directly tracking the upload session workflow on the client side rather than polling final file metadata.

For files created through OneDrive or SharePoint, standard get-items queries may return incomplete metadata. Using an upload session allows your application to handle large files efficiently and maintain the true state of the upload.

1
Create an Upload Session

Initialize the upload by calling the createUploadSession endpoint for your target OneDrive item. This returns a temporary URL for uploading the bytes.

2
Execute Byte-Range PUT Requests

Upload your file in chunks by making HTTP PUT requests containing the byte ranges to the provided upload session URL.

3
Track the HTTP Responses

Monitor the HTTP status codes returned by your PUT requests. A '202 Accepted' response indicates the upload is still in progress, while a '201 Created' or '200 OK' means the upload has successfully completed.

Utilize the Upload Session Workflow for Resumable Uploads
Free Microsoft Office alternative

Manage and Edit Your Documents Seamlessly with WPS Office

If you are dealing with complex Microsoft 365 syncing issues, consider WPS Office as a lightweight, user-friendly alternative. It offers robust local file management, deep compatibility with Microsoft formats, and seamless cloud integration without the heavy API overhead.

  1. 1. Install WPS Office: Download and install WPS Office for free on your PC, Mac, or mobile device.
  2. 2. Connect Your Cloud: Sign in to easily connect your preferred cloud storage services directly through the WPS interface.
  3. 3. Edit Seamlessly: Open, edit, and save your Microsoft Office files instantly with zero formatting loss.
Fully compatible with Microsoft Word, Excel, and PowerPoint (.docx, .xlsx, .pptx) file formats.Built-in cloud syncing capabilities as a simple, lightweight alternative to complex enterprise setups.Completely free to download with a familiar, easy-to-use tabbed interface.Handles large office files effortlessly, saving changes locally or to the cloud without sync delays.
microsoft office alternative - wps office

Frequently Asked Questions

Why does my OneDrive file show 0 bytes during upload via Microsoft Graph?

When a file is actively uploading, Microsoft Graph creates a placeholder for the drive item before the bytes are fully committed to storage. Until the upload is finalized, the API temporarily reports the file size as 0 bytes.

How should I handle large file uploads in OneDrive using Graph API?

For files larger than 4 MB, you should use the createUploadSession endpoint. This creates a resumable session, allowing you to upload the file in smaller byte chunks and safely monitor the progress.

Can I rely on eTag to know when an upload is finished?

Yes, monitoring changes to the eTag and cTag properties on a drive item is a highly effective way to detect when server-side modifications, including the finalization of an upload, have completed.

What happens if an upload session is interrupted?

If a session is interrupted, you can resume it by sending a GET request to the upload session URL. The API will respond with the expected next byte range, allowing you to continue the upload from where it left off.