lvr123 lvr123 - 7 days ago 4x
reST (reStructuredText) Question

Delete page's content with Onenote Rest API

I haven't found a way to delete items from a page's content with the onennote API.

Let's say my page's content is

<div id="div:{681ddef6-e8ad-0de3-2439-dcc668303696}{34}">
<p id="p:{f5837c83-d816-4337-ab6d-a52abde869a6}{13}">Delete me</p>
<p id="p:{1710a020-7fa3-46cb-a8ab-64209696e083}{14}">Keep me/p>

I can build a
request to insert, append, preprend, ... but that are no instructions to delete content.

I tried to replace the paragraph by some empty content:

'target': 'p:{f5837c83-d816-4337-ab6d-a52abde869a6}{13}',
'action': 'replace',
'content': ' '

but this leads to an error:

"code":"20121","message":"The PATCH argument $content: is invalid.","@api.url":""

Any suggestion ? Thanks.


Just looking at this in the microsoft graph, you can replace the content with a HTML line break.

      'target': 'p:{f5837c83-d816-4337-ab6d-a52abde869a6}{13}',
      'action': 'replace',
      'content': '<br/>'

This seems to delete the corresponding element (although the blank textbox is still selectable)