Search code examples
microsoft-graph-apionenote

UnknownError accessing pages from OneNote


I am connecting to Notebooks stored on SharePoint and getting "UnknownError" using the Graph API when trying to retrieve Pages.

I have no problem querying notebooks, sections or sectiongroups - that's all working, so no authentication problems or anything

Request:

https://graph.microsoft.com/v1.0/sites/{app id}/onenote/pages

Error below:

{
    "error": {
        "code": "UnknownError",
        "message": "",
        "innerError": {
            "request-id": "65721acc-f0d9-40d6-bf80-aac1507a6c2f",
            "date": "2018-01-02T17:34:21"
        }
    }
}

Graph explorer returns this after about 30 seconds, so I'm guessing it's timing out. There are about 10 notebooks in the site I'm connecting to, which each have several hundred pages

I do only need to return 1 page at a time in almost every case. I have tried adding a $filter= at the end, but get the same problem


Solution

  • I would strongly recommend to get pages for each section rather than getting all the pages that the user has access to.

    Please refer to the bottom 2 recommendations in this article: https://blogs.msdn.microsoft.com/onenotedev/2017/07/21/a-few-performance-tips-for-using-the-onenote-api/