【问题标题】:Page Requires Multi Part, and presentation part Microsoft Graph API页面需要多部分和演示部分 Microsoft Graph API
【发布时间】:2018-02-03 16:35:20
【问题描述】:

我正在尝试从 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 -->

这可能是什么问题?

【问题讨论】:

    标签: microsoft-graph-api onenote-api


    【解决方案1】:

    您缺少初始请求:

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

    【讨论】:

    • 谢谢先生!这解决了我的问题,您能否对 Invalid entity ID 错误有所了解?
    • 使用上面的代码得到“多部分有效负载格式错误”的问题。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-18
    • 2020-07-11
    相关资源
    最近更新 更多