1

I can successfully create a page in OneNote using the Rest API. I can also successfully indent a given page using patch. However, the issue is when I create a page and then want to indent it. I keep getting back:

<Response [404]> 
{
    "error":{
        "code":"20102","message":"The specified resource ID does not exist.","@api.url":"http://aka.ms/onenote-errors#C20102" 
    }
}

I have tried putting in long delays between the call to create the page and the call to indent it. I have also tried looping over those delays so it will retry the patch every 10s. It is very rare that it actually succeeds within X number of tries.

Is there a better way to indent a newly created page?

Elliptica
  • 3,928
  • 3
  • 37
  • 68

1 Answers1

0

Currently there is no way to do this with the OneNote API - my recommendation would be to do the following:

Create the page via POST pages

POST ~/pages

Poll the page via page content recall - this will return 404 until the page can be patched.

GET ~/pages/id/content

When the above returns 200, PATCH the page level

PATCH ~/pages/id/content

Obviously it would be better if you could directly create a page with a specific level. Please open a new suggestion in our uservoice and we will look into it.

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

Jorge Aguirre
  • 2,787
  • 3
  • 20
  • 27