Redigera

Dela via


Update page

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Update the content of a OneNote page.

Permissions

Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.

Permission type Least privileged permissions Higher privileged permissions
Delegated (work or school account) Notes.ReadWrite Notes.ReadWrite.All
Delegated (personal Microsoft account) Notes.ReadWrite Not available.
Application Notes.ReadWrite.All Not available.

HTTP request

PATCH /me/onenote/pages/{id}/content
PATCH /users/{id | userPrincipalName}/onenote/pages/{id}/content
PATCH /groups/{id}/onenote/pages/{id}/content
PATCH /sites/{id}/onenote/pages/{id}/content

Request headers

Name Type Description
Authorization string Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type string application/json

Request body

In the request body, supply an array of patchContentCommand objects that represent the changes to the page. For more information and examples, see Update OneNote page content.

Response

If successful, this method returns a 204 No Content response code. No JSON data is returned for a PATCH request.

Example

Request

The following example shows a request.

PATCH https://graph.microsoft.com/beta/me/onenote/pages/{id}/content
Content-type: application/json

[
   {
    'target':'#para-id',
    'action':'insert',
    'position':'before',
    'content':'<img src="image-url-or-part-name" alt="image-alt-text" />'
  }, 
  {
    'target':'#list-id',
    'action':'append',
    'content':'<li>new-page-content</li>'
  }
]
Response

The following example shows the response.

HTTP/1.1 204 No Content