如何使用 Microsoft Graph 更改 onenote elemente 的绝对位置

How to chage absolute position of an onenote elemente with microsoft graph

我正在尝试更改 OneNote div 的绝对位置,但没有成功。 我可以用绝对定位 div:

创建完整的 body

这是我的要求:

[
   {
    'target':'body',
    'action':'replace',
    'content':'<body data-absolute-enabled="true">
    <p>This content will appear in the _default div.</p>
    <div style="position:absolute;top:175px;left:100px" data-id="div1">
      <p>This content will appear in an absolute positioned div.</p>
    </div>
    <div>
        <p>This content will also appear in the _default div.</p>
    </div>
</body>'
  }
]

这是输出html(没关系):

<html>

<head>
    <title>x2222x</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="created" content="2021-04-18T09:13:00.0000000" />
</head>

<body data-absolute-enabled="true" style="font-family:Calibri;font-size:11pt">
    <div id="div:{f3e8317f-4b34-00f5-3826-a7b41de83075}{18}" style="position:absolute;left:48px;top:91px;width:624px">
        <p id="p:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{225}" lang="en-US" style="margin-top:5.5pt;margin-bottom:5.5pt">
            This content will appear in the _default div.</p>
        <p id="p:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{228}" lang="en-US" style="margin-top:5.5pt;margin-bottom:5.5pt">
            This content will also appear in the _default div.</p>
    </div>
    <div id="div:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{229}" data-id="div1"
        style="position:absolute;left:99px;top:174px;width:624px">
        <p id="p:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{233}" lang="en-US" style="margin-top:5.5pt;margin-bottom:5.5pt">
            This content will appear in an absolute positioned div.</p>
    </div>
</body>

</html>

OneNote Page

但是,我不能改变这个位置,我需要“移动”div1。如何将绝对位置更改为特定的 div?

这是我“移动”div1(按 ID)的请求,但它不起作用:

PACH https://graph.microsoft.com/v1.0/me/onenote/pages/{my_page_id}/content
[
   {
    'target':'div:{ef5cb98c-74e7-4c65-b51a-0adbc66d9c97}{229}',
    'action':'replace',
    'content':'<div style="position:absolute;top:350px;left:200px" data-id="div1">
      <p>This content will appear in an absolute positioned div (updated).</p>
    </div>'
  }
]

谢谢!!!

查看relevant documents page绝对定位的div不能简单替换,必须是body元素的直接children。
因此,实现您正在寻找的结果的唯一方法是替换整个 body.