1

I'm trying to read the binary contents of a file in an O365 group and I can read the raw file in my web browser after authenticating with O365, but if I use the same URL in a REST GET request, I receive the following:

<?xml version="1.0" encoding="utf-8"?><m:error xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"><m:code>-2147024891, System.UnauthorizedAccessException</m:code><m:message xml:lang="en-US">Access denied. You do not have permission to perform this action or access this resource.</m:message></m:error>

URL being used:

https://<tenant>.sharepoint.com/sites/yourSite/_api/web/GetFileByServerRelativeUrl('/sites/yourSite/shared%20documents/test.xlsx')/$value

I confirmed my authentication with O365 is valid and not causing any issues. Is there another way to retrieve the same file using Microsoft Graph (https://graph.microsoft.com/...file) instead of https://<tenant>.sharepoint.com/...file?

On a side note, it seems I can get to the point of the actual file metadata, but the '/content' doesn't show the raw file output I'm looking for as indicated for OneDrive:

https://graph.microsoft.com/v1.0/groups/<group-id>/drive/items/<item-id>/content

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.