OneNote API Issues affect Append/Prepend functionality

I spent a good chuck of time yesterday and today troubleshooting an issue with OneNote actions, only to determine the issue is at Microsoft’s end in the OneNote resources in the Microsoft Graph API which Drafts uses to integrate.

What people using OneNote integration need to know:

  • This issue does not affect actions which only create new pages in OneNote.
  • Actions which update existing pages - like those configured to append/prepend/replace - may be very unreliable at the moment. In some cases they will create a new page instead of appending, etc.

What is happening?

In order to update existing pages, Drafts has to query OneNote to find existing pages, get their current state, and construct the appropriate new information to send back to OneNote. Currently (starting at least a month ago, it seems), the methods in the OneNote API to get information about pages are returning very old information…sometimes days or more old. It will not return information about recently created pages, and will often include information about pages which no longer exist or have been moved.

Because of this, Drafts may get bad information about the state of your OneNote notebooks and not be able to find pages to update…or proceed to try to update pages which no longer exist, resulting in errors.

When did this start?

I don’t know exactly. It was drawn to my attention researching a support issue for a user who was seeing problems. Based on Googled-info, it’s been around at least a month. I know it used to work fine, so it is something that changed at Microsoft’s end.

Will Microsoft fix this?

Well, I certainly hope so. I’m working on trying to get to a technical contact or support entity that could help, but with a big company like Microsoft, that’s not that easy to do, especially if you are not inside a large corporation with MS support contracts. I will update with information when or if anything changes. It certainly seems like a big issue that must be causing trouble for some other people. I have found a few people reporting similar problems on Stack Overflow.

Technical Details

This section is primarily intended for anyone inside Microsoft who might read this post.

The specific issue is that API endpoints that return information about pages in OneNote seem to be working from cached information that is not getting updated properly when changes are made in a OneNote account.

To reproduce, you do not need an app, but can use the Microsoft Graph API Explorer. Steps:

  • Go to API Explorer, make a request for:
  • Open the same OneNote account in the app or web interface, make a number of changes to pages. Add some new ones, delete some, whatever.
  • Go back to API Explorer, make same request again:

A few notes:

  • Data will eventually get updated, but it may take days (or possibly weeks).
  • This same issue can be reproduced requesting pages of a specific section under it’s resource in the graph API.
  • This issue does not happen for other resources in the OneNote API. Changes to notebooks and sections, for example, are reflected immediately.

Yes!! I could not figure out why all my onenote actions would create sections or pages but then not be able to append or create new ones. I could delete the section in onenote and run the action again and it would work but not append or overwrite anything existing