创建页面
命名空间:microsoft.graph
重要
Microsoft Graph版本下的 /beta API 可能会发生更改。 不支持在生产应用程序中使用这些 API。 若要确定 API 是否在 v1.0 中可用,请使用 版本 选择器。
在指定分区中新建页面。
Permissions
要调用此 API,需要以下权限之一。要了解详细信息,包括如何选择权限的信息,请参阅权限。
| 权限类型 | 权限(从最低特权到最高特权) |
|---|---|
| 委派(工作或学校帐户) | Notes.Create、Notes.ReadWrite、Notes.ReadWrite.All |
| 委派(个人 Microsoft 帐户) | Notes.Create、Notes.ReadWrite |
| 应用程序 | Notes.ReadWrite.All |
HTTP 请求
POST /me/onenote/sections/{id}/pages
POST /users/{id | userPrincipalName}/onenote/sections/{id}/pages
POST /groups/{id}/onenote/sections/{id}/pages
POST /sites/{id}/onenote/sections/{id}/pages
请求标头
| 名称 | 类型 | 说明 |
|---|---|---|
| Authorization | string | Bearer {token}。必需。 |
| Content-Type | string | HTML 内容(包括多部分请求必备的“演示”部分)的 text/html 或 application/xhtml+xml。多部分请求使用 multipart/form-data; boundary=your-boundary 内容类型。 |
请求正文
在请求正文中,提供页面的 HTML 内容。
正文可以将 HTML 直接置于请求正文中,或者其可以包含多部分消息格式,如示例中所示。如果要发送二进制数据,则必须发送多部分请求。
响应
如果成功,此方法在 201 Created 响应正文中返回 响应代码和新 onenotePage 对象。
示例
请求
下面是一个请求示例。
POST https://graph.microsoft.com/beta/me/onenote/sections/{id}/pages
Content-type: multipart/form-data; boundary=MyPartBoundary198374
--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="https://..." 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--
响应
下面是一个响应示例。注意:为了简单起见,会将此处所示的响应对象截断。将从实际调用中返回所有属性。
HTTP/1.1 200 OK
Content-type: application/json
{
"title": "title-value",
"createdByAppId": "createdByAppId-value",
"links": {
"oneNoteClientUrl": {
"href": "href-value"
},
"oneNoteWebUrl": {
"href": "href-value"
}
},
"contentUrl": "contentUrl-value",
"lastModifiedDateTime": "2016-10-19T10:37:00Z"
}
反馈
提交和查看相关反馈