microsoft-graph-apionenote-api

Microsoft graph API for getting OneNote pages not working


I am trying out the OneNote APIs on the Graph Explorer. I logged into my company account and clicked the GET request under "Sample queries > OneNote > my pages". After a while, on the right panel where the result was displayed, I got the following in the "Response Preview" together with a "Unprocessable Entity - 422 - 6580ms" error box:

{
    "error": {
        "code": "20258",
        "message": "Sync of this section is not supported. Detailed error information: Getting Section",
        "innerError": {
            "date": "2020-06-22T19:44:16",
            "request-id": "cc019b4e-32fd-438a-b8ab-480b8a493784"
        }
    }
}

Additional information:

Anyone from Microsoft can help?


Solution

  • After trying the pagesUrl of every section I queried from Graph Explorer, I finally found the issue. One of the sections has a null value for its parentNotebook field. Running its pagesUrl in Graph Explorer gives the same error as simply running the all pages query. This section actually belongs to a "Quick Notes.one" notebook (I figured this out by looking into its links > oneNoteClientUrl | oneNoteWebUrl field that contains the notebook name). So this is a section of a non-web-based notebook. This notebook is automatically created by the OneNote 2016 desktop app when you open the Quick Notes notebook in it. After deleting the "Quick Notes.one" file from OneDrive, the page query goes well. When it is created again, it breaks the query. The issue has nothing to do with which folder you put the *.one notebook in. I tried both OneDrive > Notebooks, OneDrive > Documents > OneNote Notebooks, and even OneDrive > Desktop. As long as there is a *.one notebook file in a OneDrive directory, the query would just fail.