An API that connects multiple Microsoft services, enabling data access and automation across platforms
Microsoft Graph /content returns non-preauthenticated SharePoint URL which results in 401
I'm seeing behavior that appears inconsistent with the Microsoft Graph documentation for downloading driveItem content.
Expected behavior
According to the documentation, calling:
GET /drives/{drive-id}/items/{item-id}/content
should return a 302 Found redirect to a preauthenticated download URL, equivalent to @microsoft.graph.downloadUrl, which can be downloaded without additional authentication.
Observed behavior
- Retrieve driveItem metadata:
GET /drives/{drive-id}/items/{item-id}
Response contains:
"@microsoft.graph.downloadUrl": "https://<tenant>.sharepoint.com/sites/<site>/_layouts/15/download.aspx?UniqueId=<guid>&Translate=false&ApiVersion=2.0"
- Download content:
GET /drives/{drive-id}/items/{item-id}/content
Response:
302 Found
Location:
https://<tenant>.sharepoint.com/sites/<site>/_layouts/15/download.aspx?UniqueId=<guid>&Translate=false&ApiVersion=2.0
- Access the returned URL:
401 Unauthorized
The URL from @microsoft.graph.downloadUrl and the Location header are identical, but the URL is not directly downloadable and requires authentication.
Questions
- Is this behavior expected?
- Has the behavior of
@microsoft.graph.downloadUrlor/contentrecently changed? (The failure starting mid-Sep.) - Does Microsoft Graph still guarantee that
@microsoft.graph.downloadUrlis a preauthenticated download URL? - If preauthenticated download URLs are being deprecated, what is the recommended replacement for daemon/background applications downloading files from SharePoint Online?
Additional notes
- File metadata retrieval succeeds.
-
/contentreturns302successfully. - Only the final download URL returns
401. - SharePoint tenant administrators confirmed no recent SharePoint configuration changes.
- We were informed that the historical
tempauthmechanism may be deprecated, but it is unclear whether that is related to this behavior.
Any clarification would be appreciated.