Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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 your work location for the current day or current active segment. This action allows you to quickly update your work location without modifying individual occurrences.
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
POST /me/settings/workHoursAndLocations/occurrences/setCurrentLocation
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.
POST /users/{id | userPrincipalName}/settings/workHoursAndLocations/occurrences/setCurrentLocation
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, provide a JSON object with the following parameters.
| Parameter | Type | Description |
|---|---|---|
| placeId | String | Identifier of a place from the Microsoft Graph Places Directory API. Only applicable when workLocationType is set to office. |
| updateScope | workLocationUpdateScope | The scope of the update. The possible values are: currentSegment, currentDay, unknownFutureValue. |
| workLocationType | workLocationType | The new work location type to set. Supports a subset of the values of workLocationType. The possible values are: office, remote. |
workLocationUpdateScope values
| Member | Description |
|---|---|
| currentSegment | Update only the current time segment. |
| currentDay | Update the entire current day. |
| unknownFutureValue | Evolvable enumeration sentinel value. Don't use. |
Response
If successful, this action returns a 204 No Content response code.
Examples
Example 1: Set the current location to office
The following example shows how to set the current location to office.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/me/settings/workHoursAndLocations/occurrences/setCurrentLocation
Content-type: application/json
{
"updateScope": "currentDay",
"workLocationType": "office",
"placeId": "12345678-1234-1234-1234-123456789012"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content
Example 2: Set current location to remote
The following example shows how to set the current location to remote.
Request
The following example shows a request.
POST https://graph.microsoft.com/beta/me/settings/workHoursAndLocations/occurrences/setCurrentLocation
Content-type: application/json
{
"updateScope": "currentSegment",
"workLocationType": "remote"
}
Response
The following example shows the response.
HTTP/1.1 204 No Content