Update shiftPreferences

Namespace: microsoft.graph

Update the properties and relationships of a shiftPreferences object.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

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

Note: This API supports admin permissions. Users with admin roles can access groups that they are not a member of.

HTTP request

PATCH /users/{userId}/settings/shiftPreferences

Request headers

Header Value
Authorization Bearer {token}. Required. Learn more about authentication and authorization.
Content-Type application/json. Required.
MS-APP-ACTS-AS A user ID (GUID). Required only if the authorization token is an application token; otherwise, optional.

Request body

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

Response

If successful, this method returns a 204 NO CONTENT response code.

Example

Request

The following example shows a request.

PATCH https://graph.microsoft.com/v1.0/users/871dbd5c-3a6a-4392-bfe1-042452793a50/settings/shiftPreferences
Content-type: application/json

{
    "id": "SHPR_eeab4fb1-20e5-48ca-ad9b-98119d94bee7",
    "@odata.etag": "1a371e53-f0a6-4327-a1ee-e3c56e4b38aa",
    "availability": [
        {
            "recurrence": {
                "pattern": {
                    "type": "Weekly",
                    "daysOfWeek": ["Monday", "Wednesday", "Friday"],
                    "interval": 1
                },
                "range": {
                    "type": "noEnd"
                }
            },
            "timeZone": "Pacific Standard Time",
            "timeSlots": null
        }
    ]
}

Response

The following example shows the response.

HTTP/1.1 204 NO CONTENT