Skip to content

Latest commit

 

History

History
158 lines (119 loc) · 5.46 KB

File metadata and controls

158 lines (119 loc) · 5.46 KB
title Create workPlanOccurrence
description Create a new workPlanOccurrence object in your own work plan.
author emilbekj
ms.localizationpriority medium
ms.subservice outlook
doc_type apiPageType
ms.date 12/19/2025

Create workPlanOccurrence

Namespace: microsoft.graph

Create a new workPlanOccurrence object in your own work plan. Only time-off occurrences can be created directly. The workLocationType must be set to timeOff. Other occurrences are autogenerated from recurrences.

[!INCLUDE national-cloud-support]

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.

[!INCLUDE permissions-table]

HTTP request

POST /me/settings/workHoursAndLocations/occurrences

[!INCLUDE me-apis-sign-in-note]

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

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

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. The workLocationType must be set to timeOff.

Response

If successful, this method returns a 201 Created response code and a workPlanOccurrence object in the response body.

Examples

Request

The following example shows a request.

POST https://graph.microsoft.com/v1.0/me/settings/workHoursAndLocations/occurrences
Content-type: application/json

{
  "start": {
    "dateTime": "2025-12-15T00:00:00.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "end": {
    "dateTime": "2025-12-15T23:59:59.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "workLocationType": "timeOff",
  "timeOffDetails": {
    "subject": "Personal Day",
    "isAllDay": false
  }
}

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]

[!INCLUDE sample-code] [!INCLUDE sdk-documentation]


Response

The following example shows the response.

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

HTTP/1.1 201 Created
Content-type: application/json

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('12345678-1234-1234-1234-123456789012')/settings/workHoursAndLocations/occurrences/$entity",
  "id": "AAMkADljNDFhMDJjLTA2ZDItNDY2Mi04YjcxLTIzZTI4YjUyMDA0ZgBGAAAAAAAB5FC96H6HQLms31sjXiKjBwDraVMWVv9mR6-bY0mUztIzAAAAAAENAADraVMWVv9mR6-bY0mUztIzAAPENZYpAAA=",
  "recurrenceId": null,
  "workLocationType": "timeOff",
  "placeId": null,
  "start": {
    "dateTime": "2025-12-15T00:00:00.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "end": {
    "dateTime": "2025-12-15T23:59:59.0000000",
    "timeZone": "Pacific Standard Time"
  },
  "timeOffDetails": {
    "subject": "Personal Day",
    "isAllDay": false
  }
}