question

ZhengLin-2636 avatar image
0 Votes"
ZhengLin-2636 asked Deva-MSFT edited

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

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-notes
· 6
5 |1600 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.

  • Can you repro the issue consistently with the API or one-time? If its one time issue, sounds like something might have went wrong during the given point of time.

  • Does your custom app and Graph explorer uses same AAD workflow?

0 Votes 0 ·

Yes, I can reproduce it consistently. The custom app uses delegate permission for graph client api usage, which is successful on fetching pages in general and most of the resources.

0 Votes 0 ·

The error is telling that the given resource (resource id) doesn't exists at the point of time when the API is called.

0 Votes 0 ·
Show more comments

1 Answer

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

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.

5 |1600 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.