Unable to get worksheets of a workbook before opening the workbook in a browser

Sandrine Bergé-Lascombes 0 Reputation points
2024-09-20T09:56:01.2166667+00:00

Tracking ID of Microsoft previous ticket: TrackingID#2409100010002198

I am trying to get worksheets of a workbook via me/drive/items/{id}/workbook/worksheets endpoint in Postman after successful authorization via OAuth2.0 and I get a 401 Unauthorized error. However, if I open the workbook in the browser, then the request completes successfully. Here's a link to a gif that shows this behavior: https://www.dropbox.com/scl/fi/xwpo0hvvpjq18bi54ebtz/GraphIssue.gif?rlkey=2fzzlfj5i7esxva0brglt6tur&st=to3tzxmy&dl=0 It's not a permission issue, as you can see on the gif, my application gives Files.ReadWrite permissions. This looks like a bug on the graph end. Can someone look into this? Is there any changes I need to make to my Entra application to make it work? If you want to reproduce this issue, I advice to copy the workbook resid and make a Postman request on the next day without opening the workbook in the browser first.

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
12,044 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. CarlZhao-MSFT 42,031 Reputation points
    2024-09-24T08:20:24.1666667+00:00

    Hi @Sandrine Bergé-Lascombes

    I just did a quick test in Postman, and it worked fine.

    User's image

    Since this endpoint doesn't support application permissions yet, make sure you have granted the calling app the Files.ReadWrite delegated permission and requested an access token using the auth code flow. After that, clear the cache in Postman and try again.

    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.

    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.