Modifica

Update note

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 properties of a note object. Supports optimistic concurrency control via the If-Match header with the changeKey value for the note.

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) ShortNotes.ReadWrite Not available.
Delegated (personal Microsoft account) ShortNotes.ReadWrite Not available.
Application ShortNotes.ReadWrite.All Not available.

HTTP request

PATCH /me/notes/{note-id}
PATCH /users/{id | userPrincipalName}/notes/{note-id}

Request headers

Name Description
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.
If-Match The changeKey value for the note is used for optimistic concurrency control. Optional. We recommend that you use this header to avoid conflicts.

Request body

In the request body, supply only the values for properties to update. Existing properties that aren't included in the request body maintain their previous values or are recalculated based on changes to other property values.

The following table specifies the properties that can be updated.

Property Type Description
body itemBody The content of the note. Supports text or html content types. Optional.
categories String collection The categories associated with the note. Optional.
subject String The title of the note. Optional.

Response

If successful, this method returns a 200 OK response code and an updated note object in the response body.

If the If-Match header doesn't match the current changeKey, this method returns a 412 Precondition Failed response code.

Examples

Request

The following example shows a request.

PATCH https://graph.microsoft.com/beta/me/notes/AAMkAGI2THVSAAA=
Content-Type: application/json
If-Match: "CQAAABYAAABE"

{
  "subject": "Updated Meeting Notes - Jan 28",
  "body": {
    "contentType": "html",
    "content": "<html><body><h2>Updated Standup</h2><ul><li>Task 1 completed</li><li>Task 2 in progress</li></ul></body></html>"
  }
}

Response

The following example shows the response.

HTTP/1.1 200 OK
Content-Type: application/json

{
  "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('user-id')/notes/$entity",
  "id": "AAMkAGI2THVSAAA=",
  "changeKey": "CQAAABYAAABG",
  "createdDateTime": "2024-01-15T10:30:00Z",
  "lastModifiedDateTime": "2024-01-28T09:45:00Z",
  "categories": [],
  "subject": "Updated Meeting Notes - Jan 28",
  "body": {
    "contentType": "html",
    "content": "<html><body><h2>Updated Standup</h2><ul><li>Task 1 completed</li><li>Task 2 in progress</li></ul></body></html>"
  },
  "bodyPreview": "Updated Standup Task 1 completed Task 2 in progress",
  "isDeleted": false,
  "hasAttachments": false
}