1
votes

I'm using the .NET SDK of Microsoft Graph to retrieve all notebooks owned by any given user.

I attempt to retrieve OneNote sections in a user's notebook with the following code:

sections = await graphClient
  .Users[userID]
  .Onenote
  .Notebooks[notebookId]
  .Sections
  .Request()
  .GetAsync();

Some users have OneDrive's with more than 5,000 files, and this triggers a ServiceException with Error Code 10008. My understanding is that this 5,000 limitation is to do with limitations on queries over OneDrive API's and as long as queries are paged, I should be able to retrieve the information.

So, my question is, how would I write a query, to get the sections, when I know the notebookId/userId?

I do not mind falling back on using the REST api instead of the SDK if necessary.

1

1 Answers

1
votes

This is a known (and longstanding) issue. From the documentation:

10008

One or more of the document libraries on the user or group's OneDrive contains more than 5000 OneNote items (notebooks, sections, section groups), and cannot be queried using the API. Please make sure that none of the user or group's document libraries contains more than 5000 OneNote items. See the OneNote Dev blog for mitigation steps.

I recognize this is a distinction without a different (and won't help much), but this limitation isn't stemming OneDrive. I can see where it would appear that way, but it is really a limitation of SharePoint. Specifically, SharePoint throttling any document library with more than 5,000 items. Since both OneNote and OneDrive rely on SharePoint, they inherit the same limitation.