Graph API not returning all pages

Don Morris 16 Reputation points
2022-08-18T19:53:05.563+00:00

When calling the graph api with the following request, me/onenote/pages, I only get a partial list of my pages.
If I call me/onenote/notebooks, I get all my notebooks and sections. If I traverse the sections using me/onenote/sections/{id}/pages, I only get some of my pages. I get the same pages as when I use me/onenote/pages.
I don't understand why many of my pages are missing from the graph api. I can clearly see them when using the onenote desktop app. There isn't a "nextLink" property in my graph api response, so I don't think it is a paging problem.
Anyone have a clue why I can't get a complete list of onenote pages from the graph api? I'm only seeing about a third (17) of my pages.

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

6 answers

Sort by: Most helpful
  1. Don Morris 16 Reputation points
    2022-08-18T20:45:19.957+00:00

    Thanks for responding but I don't think this is going to help.

    I'm not using top. I tried it both ways, with and without top, to no avail.
    The explorer returns the same data as my ts code.
    I have about 60 pages in all of my notebooks. I'm only getting 17 when I call me/notebook/pages, which is below the default max of 20.

    Within one notebook I have multiple sections. I get pages for the last two, newest sections, but no pages for the first 7 sections, even though I can see them in the one note app.

    1 person found this answer helpful.

  2. Michael Taylor 60,161 Reputation points
    2022-08-18T20:37:27.877+00:00

    Paging is used for this API. Based upon here the default is 20. Have you tried this in Graph Explorer. In my test it does return the nextLink to give me access to the next set of pages. Note that the docs say if you use top then it doesn't return nextLink and that seems to be the case here.

    0 comments No comments

  3. Don Morris 16 Reputation points
    2022-08-18T21:22:43.59+00:00

    Thanks for trying to help.
    All of my notebooks are in the cloud for ms office 365. i'm on a Mac, but I don't believe that matters. All of my notebooks are synced.
    I made a little video to show that I have many sections with multiple pages in my business notebook. Check it out: https://1drv.ms/v/s!AgYyDlVQiQEXidY1Y2kL1xerY90B_g?e=of1M5M


  4. Don Morris 16 Reputation points
    2022-08-18T21:35:03.087+00:00

    Here is my request info

    https://graph.microsoft.com/v1.0/me/onenote/pages

    Only header I'm sending is the Authorization Bearer token

    I also tried https://graph.microsoft.com/v1.0/users/{id}/onenote/pages but there was no difference.

    Scopes = offline_access user.read user.readbasic.all notes.read notes.read.all
    I used the common parameter for authorization so I can read all notebooks the user has access to.


  5. Mirko 0 Reputation points
    2023-05-09T06:52:11.94+00:00

    I am experiencing exactly the same situation. I have:

    • Several notebooks, which appear properly
    • Several sections in each notebook, which appear properly
    • Hundreds of pages, of which only 17 appear

    If I make a request to https://graph.microsoft.com/v1.0/me/onenote/pages, I get a maximum of 17 results from various different notebooks. Changing the sort order etc. works, but the dataset is always the same 17 results only.

    If I make a request to https://graph.microsoft.com/v1.0/users/me/onenote/sections/SECTION-ID/pages?select=id,title&orderby=title, I get only pages from that section, but selected from the "global" dataset of 17 pages.

    I also tried having an user ID instead of 'me' to no avail.

    It appears that the OneNote Graph API is somehow only aware of 17 pages total of all the pages in the notebooks, making it rather unusable.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.