Jun 05 2023 10:48 AM
Hey community!
The new work hours and location feature is rolling out for Outlook and Teams:
Work Hours and Location in Outlook for Efficient Collaboration (admindroid.com)
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
Jun 05 2023 10:26 PM
@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.
Jun 06 2023 12:18 AM
Jun 13 2023 04:08 PM
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,
Jun 15 2023 07:48 AM
Jul 14 2023 10:27 AM
@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!
Jul 23 2023 11:45 PM - edited Jul 23 2023 11:45 PM
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!
Jul 24 2023 05:27 AM
@Florian_Coviflex - We do not have any information on the availability of this API. The doc would be updated whenever the API is available. Thank you.
Jul 24 2023 07:00 AM
Thank you @Meghana-MSFT, I'll look forward to it then
Jul 27 2023 11:30 AM - edited Jul 27 2023 11:51 PM
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?
Aug 09 2023 06:30 AM
I discovered the Graph feature request https://feedbackportal.microsoft.com/feedback/idea/735c1234-0807-ee11-a81c-000d3ae5b6f4 related.
Likes are needed!
Oct 06 2023 07:36 AM
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.
Oct 06 2023 08:03 AM
@Florian_Coviflex I found you can get the prescence status from /v1/presence/getpresence/ and a body payload like [{"mri":"8:orgid:$UserObjectID"}]
I am just Parsing the response JSON with a quick and dirty sample Schema, but it worked quite well in quick testing. you can also query multiple at once!
I will try to work on a blog post about it
Oct 06 2023 08:45 AM
@Kevin Crouch thanks !
Not really scalable however, for my use-case, we'd need to use the Graph API.
I've heard this is planned to open it for work location, don't know any deadline however.
Please post your blog here, I'm curious anyway.
Thanks !
Dec 11 2023 02:25 AM
@JensK2023 Does anyone have any updates on this? I too am looking to get/set work locations via graph API calls. Thanks
Dec 11 2023 02:46 AM
@jackallen98 : Nope. No update at least as far as I know.