Forum Discussion

JensK2023's avatar
JensK2023
Copper Contributor
Jun 05, 2023

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

  • jackallen98's avatar
    jackallen98
    Copper Contributor

    JensK2023 Does anyone have any updates on this? I too am looking to get/set work locations via graph API calls. Thanks

  • I discovered the Graph feature request https://feedbackportal.microsoft.com/feedback/idea/735c1234-0807-ee11-a81c-000d3ae5b6f4 related.

     

    Likes are needed!

  • 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!

    • JensK2023's avatar
      JensK2023
      Copper 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_Crouch's avatar
        Kevin_Crouch
        Brass 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. 

         

    • JensK2023's avatar
      JensK2023
      Copper Contributor
      Thank you very much! We will try this!
      • Florian_Coviflex's avatar
        Florian_Coviflex
        Copper 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!

    • RipplingGraphAPI's avatar
      RipplingGraphAPI
      Copper 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-MSFT's avatar
        Meghana-MSFT
        Bronze Contributor
        No, currently there is no such Graph API to get work location.
    • JensK2023's avatar
      JensK2023
      Copper Contributor
      Thank you for the answer. We will post in Feedpack portal.
      • uername465's avatar
        uername465
        Brass Contributor

        upvote this feature
        https://feedbackportal.microsoft.com/feedback/idea/f4ed696b-9971-ef11-a4e7-6045bdb238dc

Resources