Edit

Share via


Update workPlanOccurrence

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 workPlanOccurrence object in your own work plan. Updates require the full occurrence object to be provided (PUT semantics). PATCH isn't supported.

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

HTTP request

PUT /me/settings/workHoursAndLocations/occurrences/{id}

Note

Calling the /me endpoint requires a signed-in user and therefore a delegated permission. Application permissions aren't supported when using the /me endpoint.

When using the /users/{id} endpoint, the ID must be your own user ID.

PUT /users/{id | userPrincipalName}/settings/workHoursAndLocations/occurrences/{id}

Request headers

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

Request body

In the request body, supply a JSON representation of a workPlanOccurrence object.

Response

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

Examples

Request

The following example shows a request.

PUT https://graph.microsoft.com/beta/me/settings/workHoursAndLocations/occurrences/QAAuAAAAAB2EAxGqZhHNm8gAqgAvxFoNAOtpUxZW-2ZHr9tjSZTO0jMAA2iQN2IAABA=
Content-type: application/json

{
  "start": {
    "dateTime": "2024-01-15T08:00:00.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "end": {
    "dateTime": "2024-01-15T12:00:00.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "workLocationType": "timeOff",
  "timeOffDetails": {
    "subject": "Doctor Appointment",
    "isAllDay": false
  }
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

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

{
  "id": "AAMkAGVmMDEzMTM4LTZmYWUtNDdkNC1hMDZiLTU1OGY5OTZhYmY4OABGAAAAAAAiQ8W967B7TKBjgx9rVEURBwAiIsqMbYjsT5e-T7KzowPTAAAAAAENAAAiIsqMbYjsT5e-T7KzowPTAAABvv6cAAA=",
  "recurrenceId": null,
  "start": {
    "dateTime": "2024-01-15T08:00:00.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "end": {
    "dateTime": "2024-01-15T12:00:00.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "workLocationType": "timeOff",
  "timeOffDetails": {
    "subject": "Doctor Appointment",
    "isAllDay": false
  }
}