使用Onenote Rest API删除页面内容(Delete page's content with Onenote Rest API)

编程入门 行业动态 更新时间:2024-10-21 23:03:24
使用Onenote Rest API删除页面内容(Delete page's content with Onenote Rest API)

我没有找到使用onennote API从页面内容中删除项目的方法。

让我们说我的网页内容是

<body> <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> </div> </body>

我可以构建一个PATCH请求来插入,追加,预先读取,......但这不是删除内容的说明。

我试图用一些空的内容替换段落:

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

但这会导致错误:

{ "error":{ "code":"20121","message":"The PATCH argument $content: is invalid.","@api.url":"http://aka.ms/onenote-errors#C20121" } }

有什么建议吗? 谢谢。

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

<body> <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> </div> </body>

I can build a PATCH 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:

{ "error":{ "code":"20121","message":"The PATCH argument $content: is invalid.","@api.url":"http://aka.ms/onenote-errors#C20121" } }

Any suggestion ? Thanks.

最满意答案

只需在Microsoft图表中查看此内容,即可使用HTML换行符替换内容。

[{ 'target': 'p:{f5837c83-d816-4337-ab6d-a52abde869a6}{13}', 'action': 'replace', 'content': '<br/>' }] 这似乎删除了相应的元素(尽管空白文本框仍然是可选的)

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)

更多推荐

本文发布于:2023-08-07 07:15:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1462653.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:页面   内容   API   Onenote   Rest

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!