The process of building custom applications and tools that interact with Microsoft SharePoint, including SharePoint Online in Microsoft 365.
After April 1, 2027, GET /drives/{driveId}/items/{itemId}/content will return the file bytes directly to the authenticated caller instead of issuing a 302 to an unauthenticated URL, so the current server-call-plus-browser-redirect architecture will no longer work. ^1^
Confirmed post-retirement behavior
For the drive-item /content operation:
- The request still requires a valid Microsoft Graph access token.
- Graph returns the content in that authenticated response.
- Applications must stop depending on a
302, inspectingLocation, or forwarding that URL to an unauthenticated client. -
@microsoft.graph.downloadUrlwill no longer be an anonymous per-file capability URL. Depending on tenant configuration and API support, URL-valued properties may contain an authenticated Graph URL or a plain SharePoint URL requiring an Entra token. ^2^
Consequently, there is no documented replacement that lets the server exchange its app-only token for a short-lived, single-file URL that any browser can redeem without authentication.
Sharing links are a separate option
If customer policy permits sharing, the server can create a view sharing link and send its web URL to the browser:
POST /v1.0/drives/{driveId}/items/{itemId}/createLink
Authorization: Bearer {server-app-token}
Content-Type: application/json
{
"type": "view",
"scope": "anonymous",
"expirationDateTime": "{near-future UTC timestamp}"
}
Your existing Files.ReadWrite.All application permission satisfies the documented least-privileged application permission for createLink; Sites.ReadWrite.All is also accepted as a higher privilege. ^3^
Important differences from the retiring download URL:
- It is a sharing web link, not a documented raw-byte or attachment-style download endpoint. It may open Microsoft’s file-viewing experience, from which downloading can be available.
- An anonymous link grants access to anyone possessing it and can be disabled by the tenant administrator.
-
createLinkcan return an existing link of the same type for that application rather than minting a unique capability for every download. - The permission remains visible on the item and can be removed by an owner.
- Links do not automatically expire unless an expiration is supplied or tenant policy enforces one.
- Administrators can require expiration and cap the maximum lifetime of “Anyone” links. ^4^
Therefore, use createLink only if a persistent sharing permission and SharePoint/OneDrive browser experience meet the requirement. It is not documented as a direct replacement for tempauth downloads.
Browser-authenticated download
A browser SPA can use MSAL.js to obtain a delegated Graph token for its signed-in user; browser applications are public clients and cannot safely hold certificates, secrets, or app-only credentials. ^5^
That solves token acquisition, but the available documentation does not establish a CORS-supported browser request pattern for receiving the future direct /content response. The currently documented JavaScript workaround—fetching @microsoft.graph.downloadUrl without an authorization header—depends specifically on the preauthenticated URL being retired. ^6^
Until Microsoft documents and supports the necessary CORS behavior, do not treat delegated authentication alone as a complete direct-browser-download solution. Validate the post-retirement behavior in a test tenant before adopting it.
Do not expose the app-only token
Do not send the certificate-acquired application token to the browser. It carries the application roles granted to the app and is not converted into a single-file token.
Files.SelectedOperations.Selected can restrict an application to explicitly assigned files, but this is a durable application/resource permission model: it requires Entra consent, an explicit assignment on the resource, and a token containing that Selected permission. Assigning file-level permissions also breaks inheritance. It is not an ephemeral browser download token. ^7^
Practical architecture choices
- Sharing is acceptable: create a read-only sharing link, enforce a short expiration, and send the browser to Microsoft’s sharing experience.
- The user can authenticate and Microsoft confirms CORS support: use MSAL.js and delegated permissions, then let the browser call the supported authenticated content endpoint.
- Neither condition applies: the established fallback is for your backend to call
/contentand stream/proxy the response. This does put bytes through your infrastructure; no equivalent anonymous per-download URL is currently documented.
The UseGraphUrl tenant setting is useful for administrator-controlled compatibility testing, but it does not create anonymous URLs or solve browser token/CORS constraints. A SharePoint administrator can target a third-party app with Set-SPOTenantPreAuthSettings -UseGraphUrlIsEnabled $true -UseGraphUrlAppsList "<app-id>"; test this outside production first. ^2^
Capacity planning
Current default SharePoint limits include:
- Downloading a drive item: 1 resource unit.
- Specific sharing APIs: 300 requests per five minutes per app per tenant.
- Application egress: 400 GB per hour per app per tenant.
- Anonymous download egress: 100 GB per site per two hours.
- Multitenant application usage is isolated per tenant/application pair.
These defaults can change. Handle 429 and 503 by honoring Retry-After, monitor RateLimit headers, reduce concurrency, and avoid bursts. ^8^
References
- Pre-authenticated (tempauth) URLs are retiring: move to Microsoft Entra ID tokens before April 1, 2027 - Microsoft 365 Developer Blog
- Set-SPOTenantPreAuthSettings (Microsoft.Online.SharePoint.PowerShell) | Microsoft Learn
- Create a sharing link for a DriveItem
- Manage sharing settings for SharePoint and OneDrive in Microsoft 365
- Public client and confidential client applications
- Download driveItem content
- Overview of Selected permissions in OneDrive and SharePoint
- Avoid getting throttled or blocked in SharePoint Online