1
votes
  1. When a section renamed get sections API doesn't reflect the updated name whereas get page api shows updated parent section name. This seems to be bug/ data inconsistency in ON API.

  2. On change of anything at page level updates the lastModifiedDateTime for a section but nothing gets changed at notebook level. This again seems to be like some data inconsitency issue.

Can somebody clear this confusion.

(Note - All above can be tested using MS Graph API Explorer )

1

1 Answers

1
votes

These are two separate topics:

  1. Section renaming

This is a known limitation/bug in OneNote - if you rename a section in OneNote Online (in your browser), then the API GET ~/notebooks/id/sections or GET ~/sections will give you the "old" name. This is because OneNote Online doesn't actually rename a file, it only marks the file as "to be renamed" - if you were to look at the file itself in OneDrive/SharePoint it would still have the old name.

Once the OneNote Native Client sees the section (for example OneNote for Windows) sees the section that has been marked as "to be renamed", it actually renames the file.

The OneNote API GET ~/sections/id/pages actually looks at the section binaries and is able to tell whether the section is renamed or not, which is why that name can be trusted as the "most up to date" one.

I have communicated this feedback to our team and we are exploring alternatives - I encourage you to start an item in uservoice so we can better understand impact.

https://onenote.uservoice.com/forums/245490-onenote-developer-apis

  1. LastModifiedTime (LMT) on notebook/section clarifications:

The LMT of a section is equal to max(LMT of pages under it).

The LMT of a section group however is not max (LMT of sections and section groups under it). A section group is a folder and its LMT should behave like that of a folder in a traditional file system (reflects time of last add/delete of a file/folder directly under it).

However, there is nothing stopping you from using $expand and calculating the LMT (as you understand it) yourself based on the entities below the notebook/section group. https://blogs.msdn.microsoft.com/onenotedev/2014/12/16/beta-get-onenote-entities-in-one-roundtrip-using-expand/