Microsoft graph api 替换操作会断开OneNote中的嵌套列表(图形API)
用户在OneNote中将其待办事项组织为嵌套列表,如下所示: 我需要将“任务A”标记为已完成。根据a,我应该为todo执行替换操作 首先,我调用Microsoft graph api 替换操作会断开OneNote中的嵌套列表(图形API),microsoft-graph-api,onenote,onenote-api,Microsoft Graph Api,Onenote,Onenote Api,用户在OneNote中将其待办事项组织为嵌套列表,如下所示: 我需要将“任务A”标记为已完成。根据a,我应该为todo执行替换操作 首先,我调用GET/me/onenote/pages/{pageId}/content?includeId=true以查找todo“任务A”的正确id(请参阅“修补程序之前的页面内容”⇩). 然后我发送带有正文的PATCH/me/onenote/pages/{pageId}/content: [ { "action": "replace", "t
GET/me/onenote/pages/{pageId}/content?includeId=true
以查找todo“任务A”的正确id(请参阅“修补程序之前的页面内容”⇩).
然后我发送带有正文的PATCH/me/onenote/pages/{pageId}/content
:
[
{
"action": "replace",
"target": "p:{33109592-eab9-44fa-8cec-867ab11cecfd}{55}",
"content": "<p data-tag=\"to-do:completed\" style=\"margin-top:0pt;margin-bottom:0pt\">Task A</p>"
}
]
[
{
“操作”:“替换”,
“目标”:“p:{33109592-eab9-44fa-8cec-867ab11cecfd}{55}”,
“内容”:“任务A
”
}
]
API响应204,“任务A”现在已完成。但它已移至“第2点”下:
如果我替换“任务B”的标记,同样的问题也会出现——它将变为已完成,但位于“子任务B1”下
如何在不破坏列表的情况下替换待办事项?
补丁前的页面内容(图形API响应)
嵌套列表
任务A
第1点
第2点
任务B
子任务B1
补丁后的页面内容(图形API响应)
嵌套列表
第1点
第2点
任务A
任务B
子任务B1
对于这个问题,我不知道API服务器端是如何处理的。您可以在中提交功能请求,也可以在中提交错误
客户端的一个解决方法:在任务A和点1之间添加emtpy行。我已经测试过了,在我这边效果很好
<div id="div:{46b62548-ca53-41b9-90e1-75d14bbc7504}{38}" style="position:absolute;left:48px;top:115px;width:624px">
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{139}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{137}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{9c90b33e-de52-4fe5-9ebe-a6f0787cc91b}{131}" data-tag="to-do:completed" style="margin-top:0pt;margin-bottom:0pt">Task A</p>
<br />
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{211}" style="margin-top:0pt;margin-bottom:0pt">Point </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{141}" style="margin-top:0pt;margin-bottom:0pt"> Point2</p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{169}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{145}" data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt">Task B</p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{173}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{144}" data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt"> SubTask B1</p>
</div>
任务A
点
第2点
任务B
子任务B1
<html lang="en-US">
<head>
<title>Nested list</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="created" content="2018-10-04T09:46:00.0000000" />
</head>
<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
<div id="div:{33109592-eab9-44fa-8cec-867ab11cecfd}{49}" style="position:absolute;left:76px;top:144px;width:548px">
<p id="p:{33109592-eab9-44fa-8cec-867ab11cecfd}{52}" style="margin-top:0pt;margin-bottom:0pt">Point 1</p>
<p id="p:{33109592-eab9-44fa-8cec-867ab11cecfd}{54}" style="margin-top:0pt;margin-bottom:0pt">Point 2</p>
<p id="p:{b815e00e-3326-49db-bcdd-7aecba36b1a4}{92}" data-tag="to-do:completed" style="margin-top:0pt;margin-bottom:0pt">Task A</p>
<p id="p:{33109592-eab9-44fa-8cec-867ab11cecfd}{59}" data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt">Task B</p>
<p id="p:{33109592-eab9-44fa-8cec-867ab11cecfd}{58}" data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt">Subtask B1</p>
</div>
</body>
</html>
<div id="div:{46b62548-ca53-41b9-90e1-75d14bbc7504}{38}" style="position:absolute;left:48px;top:115px;width:624px">
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{139}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{137}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{9c90b33e-de52-4fe5-9ebe-a6f0787cc91b}{131}" data-tag="to-do:completed" style="margin-top:0pt;margin-bottom:0pt">Task A</p>
<br />
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{211}" style="margin-top:0pt;margin-bottom:0pt">Point </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{141}" style="margin-top:0pt;margin-bottom:0pt"> Point2</p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{169}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{145}" data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt">Task B</p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{173}" style="margin-top:0pt;margin-bottom:0pt"> </p>
<p id="p:{6a8603ba-4743-4f74-a61a-795245aa36b0}{144}" data-tag="to-do" style="margin-top:0pt;margin-bottom:0pt"> SubTask B1</p>
</div>