Search code examples
pythondelete-fileonenotehttp-deleteonenote-api

How to Stop OneNote API From Returning ID for Deleted Pages


I place a call using the OneNote REST API to return a list of all the pages in a section. This works successfully. However, some of the pages it returns should no longer exist! Yet I can see their information, IDs, etc., even though they have previously been deleted. But if I try to delete them again using REST, I get the error:

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

How come OneNote keeps returning pages that no longer exist (even after many days), and how do I prevent it from doing so?


Solution

  • EDIT: This option is no longer available.


    I assume these pages do appear as deleted in your notebook if you open OneNote. Can you try adding this header to your GET ~/pages request?

    FavorDataRecency: true
    

    This will bypass our index and go directly to your pages. It will take longer but should be consistent - do you see your pages when you do that?

    Additionally, to better investigate this on our end, can you provide us with - The value of the X-CorrelationId header of your API request to GET pages (the one without the FavorDataRecency header) - One of the id's of your deleted pages