Graph Onenote API returns "resource does not exist" for resource accessible through graph explorer

Zheng Lin 1 Reputation point Microsoft Employee
2021-01-17T01:12:36.15+00:00

I am using graph onenote API to download an onenote resource with the following uri:
'https://graph.microsoft.com/v1.0/sites/microsoft.sharepoint.com,d4a24c1a-adb9-4906-90bf-c9c0e8786872,9b832d0a-7386-401f-bea2-115fd5461cf4/onenote/resources/<resource id>
and got ServiceException of error:

"{\r\n \"error\": {\r\n \"code\": \"20102\",\r\n \"message\": \"The specified resource ID does not exist.\",\r\n \"innerError\": {\r\n \"date\": \"2021-01-15T23:26:19\",\r\n \"request-id\": \"49395dbd-d437-48e0-9ed9-a424a27e2765\",\r\n \"client-request-id\": \"49395dbd-d437-48e0-9ed9-a424a27e2765\"\r\n }\r\n }\r\n}"

However, if I copy and paste the same uri into the graph explorer, I was able to get the resource with 200. And I was able to download other resources inside the same onenote notebook as well.

Any idea what is the cause?

Thanks

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,569 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Deva-MSFT 2,256 Reputation points Microsoft Employee
    2021-01-23T13:30:52.273+00:00

    Say, if the same call works in delegated permission(Graph explorer) and the same fails in custom application, you may need to validate the AAD flow or its token by checking its scopes/permissions and whether the API is designed to work in delegated/application or not. If you see any differences, do share here - good to help.

    0 comments No comments