Behavior of client‑side CancellationToken for Microsoft Graph requests handed off to backend services
0 reputation · 13 Jun 2022, 17:20 UTC
Determine whether supplying a CancellationToken to Microsoft Graph SDK calls reliably aborts server‑side processing for operations that are delegated to backend services (such as mailbox provisioning, large file uploads, or directory synchronization). The SDKs propagate the token to the underlying HTTP layer, long‑running operations can be made asynchronous with the Prefer: respond‑async header, and each endpoint documents its own service‑side timeout limit.
However, observations indicate that once a request has been handed off to a backend service (e.g., Exchange Online mailbox processing or SharePoint site creation), the client‑side CancellationToken may be ignored, allowing the operation to continue until the backend finishes or hits its own timeout, which can leave partial side‑effects. The exact set of endpoints that honor cancellation and the guarantees provided are not clearly documented.
Which Graph endpoints guarantee that a cancelled request stops server‑side work immediately? How can developers detect partial completion when cancellation is ignored by the backend? Are there recommended patterns (e.g., using Prefer: respond‑async and polling) to achieve reliable cancellation for long‑running Graph operations?