Search code examples
office-jsoffice365apioffice365-appsonenote-api

OneNote page clientUrl uniqueness


I'm developing an add-in for OneNote and trying to store some data for each pages.
As page data from office.js doesn't have ID compatible with OneNote REST API, I used clientUrl to use REST API. ( Difference between notebook id by OfficeJS and OneNote API )

But I found multiple pages have same clientUrl.
Here is real example from me.

{
  id: "1-486e5b3666204a2d86c9394a83acd8b8!39-8b4a7756-1039-4ec5-b988-0734dbe02748",
  links: {
    oneNoteClientUrl: {
      href: "onenote:https://oneeducationorg-my.sharepoint.com/personal/dongseok_one-education_org/Documents/Class%20Notebooks/Biology/Rangan%20Srikhanta/Homework.one#Geo%20learn%201&section-id=8b4a7756-1039-4ec5-b988-0734dbe02748&page-id=200133b3-ec2f-4046-86eb-85979437c973&end"
    }
  }
}


{
  id: "1-2ca4377c872f4f99ab872de4876a1755!146-8b4a7756-1039-4ec5-b988-0734dbe02748",
  links: {
    oneNoteClientUrl: {
      href: "onenote:https://oneeducationorg-my.sharepoint.com/personal/dongseok_one-education_org/Documents/Class%20Notebooks/Biology/Rangan%20Srikhanta/Homework.one#Geo%20learn%201&section-id=8b4a7756-1039-4ec5-b988-0734dbe02748&page-id=200133b3-ec2f-4046-86eb-85979437c973&end"
    }
  }
}

So my question is

  1. Are these cases just something buggy or it can be happened as normally? ( I think I copied those pages by using 'copyToSection' method from add-in API - https://dev.office.com/reference/add-ins/onenote/page )

  2. Can I keep use clientUrl as unique identifier for each page? If not, what can I use as an unique identifier from page data that retrieved from office.js?


Solution

  • You can now use "GetRestApiId"

    https://github.com/OfficeDev/office-js-docs/blob/master/reference/onenote/page.md#getRestApiId