Replace shift
Namespace: microsoft.graph
Replace an existing shift.
If the specified shift doesn't exist, this method returns 404 Not found
.
The duration of a shift can't be less than 1 minute or longer than 24 hours.
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) | Schedule.ReadWrite.All | Group.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Schedule.ReadWrite.All | Not available. |
HTTP request
PUT /teams/{teamId}/schedule/shifts/{shiftId}
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 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 |
---|---|---|
draftShift | shiftItem | Draft changes in the shift. Draft changes are only visible to managers. The changes are visible to employees when they're shared, which copies the changes from the draftShift to the sharedShift property. Either draftOpenShift or sharedOpenShift should be null . |
isStagedForDeletion | Boolean | The shift is marked for deletion, a process that is finalized when the schedule is shared. Optional. |
schedulingGroupId | String | ID of the scheduling group the shift is part of. Required. |
sharedShift | shiftItem | The shared version of this shift that is viewable by both employees and managers. Updates to the sharedShift property send notifications to users in the Teams client. Either draftOpenShift or sharedOpenShift should be null . |
userId | String | ID of the user assigned to the shift. Required. |
Response
If successful, this method returns a 204 No Content
response code and empty content. If the request specifies the Prefer
header with return=representation
preference, then this method returns a 200 OK
response code and a shift object in the response body.
Example
Request
The following example shows a request.
PUT https://graph.microsoft.com/v1.0/teams/{teamId}/schedule/shifts/{shiftId}
Content-type: application/json
{
"userId": "5ca83ce7-291d-43b7-bf53-af79eef4bc1d",
"draftShift": {
"displayName": null,
"startDateTime": "2024-10-08T15:00:00Z",
"endDateTime": "2024-10-09T00:00:00Z",
"theme": "blue",
"notes": null,
"activities": []
},
"sharedShift": null,
"isStagedForDeletion": false
}
Response
The following example shows the response.
Note: The response object shown here might be shortened for readability.
HTTP/1.1 204 No Content