Forum Discussion
Set work location via API (Graph?)
Hey community!
The new work hours and location feature is rolling out for Outlook and Teams:
https://blog.admindroid.com/work-hours-and-location-in-outlook-for-efficient-collaboration/
Does anyone know who to read and write this information (especially the location) via API / Microsoft Graph? This is a nice feature and we would like to set this programmatically.
Thank you very much!
Best regards,
Jens
17 Replies
- jackallen98Copper Contributor
JensK2023 Does anyone have any updates on this? I too am looking to get/set work locations via graph API calls. Thanks
- JensK2023Copper Contributor
jackallen98 : Nope. No update at least as far as I know.
- Florian_CoviflexCopper Contributor
I discovered the Graph feature request https://feedbackportal.microsoft.com/feedback/idea/735c1234-0807-ee11-a81c-000d3ae5b6f4 related.
Likes are needed!
- mesh-austindelarosaCopper Contributor
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 remoteHope this helps!
- JensK2023Copper Contributor
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_CrouchBrass 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.
- JensK2023Copper ContributorThank you very much! We will try this!
- Florian_CoviflexCopper Contributor
Do you know when the possibility of doing this via API will be opened up? In order to synchronize these workLocations with another internal tool? Meghana-MSFT
Thank you!
- Meghana-MSFTBronze Contributor
JensK2023 - Currently there is no Graph API to set/get work location and working hours via Graph API. You can suggest this feature at Microsoft Teams Feedback portal.
- RipplingGraphAPICopper Contributor
Hi Meghana-MSFT !
How about using Graph API to get the work location? Is it supported? I mean the work location set in the calendar on outlook.Thanks,
- Meghana-MSFTBronze ContributorNo, currently there is no such Graph API to get work location.
- JensK2023Copper ContributorThank you for the answer. We will post in Feedpack portal.
- uername465Brass Contributor
upvote this feature
https://feedbackportal.microsoft.com/feedback/idea/f4ed696b-9971-ef11-a4e7-6045bdb238dc