question

onmicrosoft-7036 avatar image
0 Votes"
onmicrosoft-7036 asked ·

Unable to access files in onedrive, getting FileOpenUserUnauthorized

Hey there, I am trying to use the graph api, connecting via authorization code oauth. I have an application in Azure that has all the permissions enabled (not recommended but I did these for debug purposes).

The problem is that when I try to retrieve a file via the api (get a workbook for example) I get the following error:

{
"error": {
"code": "FileOpenUserUnauthorized",
"message": "You do not have permissions to open this file in the browser.",
"innerError": {
"code": "unauthorizedUncategorized",
"message": "Required authentication information for the resource is either missing or invalid.",
"innerError": {
"code": "FileOpenUserUnauthorized",
"message": "You do not have permissions to open this file in the browser."
},
"date": "2021-03-12T10:48:17",
"request-id": "dff28442-d497-4956-bcdf-526b31e669a8",
"client-request-id": "dff28442-d497-4956-bcdf-526b31e669a8"
}
}
}

The request is:

GET https://graph.microsoft.com/v1.0/me/drive/items/MY_WORKBOOK_ID/workbook/worksheets
Authorization Bearer xxxx

I am mentioning that ALL THE PERMISSIONS ARE GRANTED IN AZURE, and I am able to authenticate successfully as other operations like, list files in my drive, are working fine via the api.

Any thoughts of what I should check.

microsoft-graph-sdkmicrosoft-graph-workbooks
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

Deva-MSFT avatar image
0 Votes"
Deva-MSFT answered ·

Above error is telling that you don't have necessary permission to access the onedrive. Validate the token in https://jwt.ms and make sure the logged on user has necessary permissions in it or not. If not, make sure to add them in your AAD/Graph permissions and then give a try, then you will see that you can access the resources.

·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.