问题
Summary
In my pursuit of getting up to date information about my most recently modified OneNote pages via the REST API, I conducted a short experiment where I created a new Outlook ID; created OneNote notebooks, sections, and pages using both Windows and Mac; and used Graph Explorer to run OneNote API queries. I found that requests for page information using GET .../pages
did not work and is most likely a result of API information not updating in real time. Further details are provided below; I would greatly appreciate any more insight or alternative methods for getting page information from a specific section using the OneNote REST API via Microsoft Graph.
Details
Early today, I created a new @outlook.com account using Google Chrome on my Macbook Pro. Then using OneNote for Mac, I created a new notebook, section, and page. All aspects of this synchronized in realtime with OneNote Online. However, the GET https://graph.microsoft.com/v1.0/me/onenote/pages
call in Microsoft Graph Explorer did not render any page information despite having a 200 status. I subsequently signed into this new outlook account on a nearby Windows computer and was able to synchronize all content in OneNote for Windows immediately. I created a new notebook, section, and page on the Windows machine and then used Graph Explorer on this machine as well; the same call did not render any page information despite having a 200 status. This was also observed when calling the pages from a specific section. Syntonization between both computers was virtually instant.
I proceeded to use GET https://graph.microsoft.com/v1.0/me/onenote/sections
and GET https://graph.microsoft.com/v1.0/me/onenote/notebooks
. These calls provided up to date information about notebooks and sections respectively. Additionally, I used POST https://graph.microsoft.com/v1.0/me/onenote/sections/{section-id}/pages
via Graph Explorer on the Windows machine to post a sample page (see code under "Construct the Message Body") to one of my sections. This page rendered immediately on both computers. Using GET .../pages
on the Windows machine returned information for only this posted page. The same call on the Mac via Graph Explorer did not render any information despite a 200 status.
I previously posted a question about why there seemed to be a 3-day lag about page information from the OneNote API. Consistent with this behavior, it appears that page information is updating much slower (on the order of days) than notebook or section information (one the order of seconds). Additionally, the same lagging behavior is seen when calling the API through my own program.
Key Points
While section and notebook information is updating in real time, page information through the
GET .../pages
call does not appear to work properly.This problem does not appear to be related to operating system, a single account, or application making the call because both Windows and Mac were used, results were comparable between an existing account and a new one created for this experiment, and results are comparable when using Graph Explorer or placing API calls via R.
This the problem seems to be localized to the functions or processes that fetch page information or create page information for the API, because synchronization between official OneNote programs seems to be intact.
来源:https://stackoverflow.com/questions/59637838/onenote-api-pages-endpoint-not-working-properly