Microsoft graph api error "You do not have permissions to open this file in the browser."

developeruser 5 Reputation points
2024-05-13T15:01:27.7+00:00

There was no problem when I first created the microsoft account. After some time passed, when I tried to request again, I got an error.

I send a request to this endpoint and the following error is returned.

"https://graph.microsoft.com/v1.0/me/drive/items/{drive-item-id}/workbook/worksheets"

{"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":"2024-05-13T14:34:36","request-id":"f6e36068-3345-4a70-88f2-22aeb0fd1c23","client-request-id":"f6e36068-3345-4a70-88f2-22aeb0fd1c23"}}}


I gave all the necessary permissions.

Screenshot 2024-05-13 at 17.56.47

I don't know what is the problem. Please, help me :(

Microsoft Security | Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. CarlZhao-MSFT 46,371 Reputation points
    2024-05-14T02:13:32.76+00:00

    Hi @developeruser

    It is only available in a delegated context. Try assigning the Files.ReadWrite delegated permission to the calling app, and then request an access token using a delegated authentication flow with user participation.

    User's image

    Or log in to Graph Explorer with your user and call this API directly.

    59376133-2c72-4edc-b2f7-24ddcb64a632

    Hope this helps.

    If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.


  2. Vladislav Kosev 0 Reputation points
    2025-03-16T10:11:58.2333333+00:00

    It appears it is not supported for files stored in personal accounts: https://github.com/OfficeDev/office-js/issues/4506

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.