Forum Discussion
Set work location via API (Graph?)
JensK2023 you're capable of hitting this particular endpoint just fine.
address: "https://presence.teams.microsoft.com"
uri: /v1/me/workLocation
body:
{
"location": "@{variables('vStatus')}",
"expiration": "@{formatDateTime(body('Current_time'), 'yyyy-MM-ddT22:00:00.0Z')}"
}
"0" clears your status
"1" is in office
"2" is remote
Hope this helps!
I try to rebuild this, but I am not authorized. We try to hand over an access token. What scopes do I need for setting this work location?
- Kevin_CrouchOct 06, 2023Brass Contributor
I have this working with the Body they mentioned above.
The time portion for formatDateTime comes from adding the "Current Time" action earlier in the flow.
And the SharePoint is just the "Send an HTTP Request to SharePoint" item.
Rather than making you manually deal with the access tokens, this offloads the Access Tokens to the SharePoint Connection.The Manually triggering the flow is just for Demo purposes, of course.
I'm hoping to try and make something that will look for my location at, say, 8am and if it is still my home set my location to "Working Remotely" but if I am at the Office, set it to "Office"
Unfortunately, it doesn't look like there is support for custom locations listed, or it might be useful that it could even show things like "At Client X" - but I suppose that could potentially just go in the Custom Status field instead.