Reducing Microsoft Graph API Noise with ETag-Based Conditional Requests
Stop over-fetching OneDrive data. Learn how to use ETag-based conditional requests in Microsoft Graph to reduce API noise, avoid 429 throttling, and implement efficient incremental syncs.
21 Mar 2026, 21:35 UTC

The Cost of Over-Fetching OneDrive Data
When building applications that sync files from OneDrive or SharePoint, the instinct is often to poll the Microsoft Graph API for changes. However, requesting the full metadata of a file or folder every few minutes is inefficient. You consume unnecessary bandwidth, increase the risk of hitting 429 (Too Many Requests) throttling limits, and force your application to process data that hasn't actually changed.
The solution is to move from full fetches to conditional requests using ETags. An ETag (Entity Tag) is an opaque identifier assigned by the server to a specific version of a resource. If the resource hasn't changed, the server tells you immediately without sending the entire data payload again.
How ETags Enable Incremental Sync
In Microsoft Graph, an ETag acts as a version fingerprint. When you perform a GET request for a drive item, the response includes an @odata.etag property in the body and an ETag header in the HTTP response.
To implement a conditional request, your application stores that ETag locally. The next time you check for updates, you send that token back to the server using the If-None-Match HTTP header. The server then performs a quick comparison:
- If the ETag matches: The server returns a 304 Not Modified response. No body is sent, saving bandwidth and processing time.
- If the ETag differs: The server returns a 200 OK with the updated resource data and a new ETag.
Implementation Pattern: OneDrive File Sync
To implement this, you need Files.Read.All or Sites.Read.All permissions. While you can use the Graph SDK, understanding the raw HTTP flow is critical for debugging throttling and header propagation.
Step 1: Initial Fetch
Run a standard GET request to retrieve the item and its current version token.
# Request (Run via Graph Explorer or registered App)
GET https://graph.microsoft.com/v1.0/me/drive/items/{item-id}
Expected Result: A 200 OK response containing the file metadata and a header like ETag: "6384920102".
Step 2: The Conditional Check
Store that ETag. On the next sync cycle, include it in the request header.
# Request
GET https://graph.microsoft.com/v1.0/me/drive/items/{item-id}
If-None-Match: "6384920102"
Expected Result: If the file hasn't been edited, you will receive a 304 Not Modified. Your app can now skip the update logic for this specific file.
Optimizing Large Collections
ETags are per-resource, not per-folder. If you are monitoring a folder with 1,000 files, sending 1,000 conditional requests is still noisy. To optimize this, combine ETags with $filter on the lastModifiedDateTime property.
First, query the folder for items modified since your last successful sync:
GET /me/drive/root/children?$filter=lastModifiedDateTime gt 2023-10-01T00:00:00Z
Then, for the subset of files that appear to have changed, use the If-None-Match header to verify if the change was significant enough to update the ETag. This two-tier approach drastically reduces the number of full payloads your app must parse.
Trade-offs and Limitations
| Constraint | Impact | Mitigation |
|---|---|---|
| Case Sensitivity | ETags must be matched exactly; slight variations cause 200 OKs. | Treat ETags as opaque strings; do not modify them. |
| Compliance Holds | Some retention policies may keep lastModifiedDateTime static. | Rely on the ETag header rather than the date property for final verification. |
| SDK Abstraction | Some older Graph SDK versions hide HTTP headers. | Use a middleware handler or the raw HttpClient to capture 304 responses. |
Verifying Your Implementation
To confirm your sync logic is working, use a tool like Graph Explorer or Postman:
- Perform a GET request and copy the ETag header value.
- Immediately perform the request again using If-None-Match: [copied-value]. You should see a 304 Not Modified.
- Modify the file in OneDrive (e.g., rename it or edit a sentence).
- Repeat the conditional request. You should now receive a 200 OK with a new ETag.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.