Search code examples
onenoteonenote-api

How to fix error: "The URI segment 'notebooks' is invalid after the segment 'notes'"


I'm trying to get information about a OneNote notebook that is stored in CRM. Using the CRM api, I can fetch OneNote notebook ids, which I should be able to send to the OneNote api to get its contents. However, when I send a request I get the error: "The OData query is invalid. The URI segment 'notebooks' is invalid after the segment 'notes'."

I have to request a Bearer Access token, and I made an application which has the permission: Notes.Read.All, which should enable me to have access to read OneNote books across the organization.

The following url seems to say that my request should be valid syntax. Perhaps I'm using an incorrect site id or something?

https://learn.microsoft.com/en-us/graph/api/onenote-list-notebooks?view=graph-rest-1.0

The bearer token is able to fetch information about a user's specific OneNote books with no issues, but I need to be able to fetch by the site where they are stored.

My request looks like the following (numbers and letter placed by me): GET: https://graph.microsoft.com/v1.0/sites/aaaaaaaa-5555-4444-bbbb-g7g8g9g10/onenote/notebooks


Solution

  • Site Id has to be specified in a 3 part (separated by 2 commas) like format. See it's documentation at: https://learn.microsoft.com/en-us/graph/api/site-get?view=graph-rest-1.0

    Thanks!