页面需要多个部分,以及演示文稿部分Microsoft Graph API

时间:2017-08-25 15:17:06

标签: microsoft-graph onenote-api

我正在尝试从Microsoft Graph API向OneNote发布一个页面,当我输入该页面所需的部分ID以便发布它时会抛出一个错误,指出:

  

页面创建请求要求内容为多部分,并带有演示文稿部分。

我的请求标题如下所示:

<!-- MyPartBoundary198374 -->
Content-Disposition:form-data; name="Presentation"
Content-Type:text/html

<!DOCTYPE html>
<html>
  <head>
    <title>A page with <i>rendered</i> images and an <b>attached</b> file</title>
    <meta name="created" content="2015-07-22T09:00:00-08:00" />
  </head>
  <body>
    <p>Here's an image from an online source:</p>
    <img src="http://..." alt="an image on the page" width="500" />
    <p>Here's an image uploaded as binary data:</p>
    <img src="name:imageBlock1" alt="an image on the page" width="300" />
    <p>Here's a file attachment:</p>
    <object data-attachment="FileName.pdf" data="name:fileBlock1" type="application/pdf" />
  </body>
</html>

<!-- MyPartBoundary198374 -->
Content-Disposition:form-data; name="imageBlock1"
Content-Type:image/jpeg

<!--  ... binary image data ...    -->

<!-- MyPartBoundary198374 -->
Content-Disposition:form-data; name="fileBlock1"
Content-Type:application/pdf

<!-- ... binary file data ... -->

<!-- MyPartBoundary198374 -->

这可能是什么问题?

1 个答案:

答案 0 :(得分:0)

您错过了初始请求:

POST https://graph.microsoft.com/v1.0/me/onenote/sections/{id}/pages
Content-length: 312
Content-type: multipart/form-data; boundary=MyPartBoundary198374