Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I update Presence/Status/Availability in MS Teams via an API call?

I am aware of the beta Graph Presence API. However, this currently only allows retrieving Presence data. I would like to be able to change a Teams user's status availability using an api call. The most recent information that I could find is several years old: (Does Microsoft Teams have a way to update a user's status/presence?)

If the Teams API does not contain this functionality, can it still be done via the underlying UCWA API if that is still available for Teams? Or, more generally, is there some other way to have an external application update a Teams user's status availability?

Alternatively, is there a way to update the availability/status in Office 365 via an api call?

like image 635
dda Avatar asked May 18 '20 22:05

dda


People also ask

Is there an API for Teams?

You can create websites, services, and native platform applications that run outside the Microsoft Teams user experience, and call the Teams API to automate Teams scenarios.

How does Microsoft Teams determine availability?

In essence, the Microsoft Teams online availability is in sync with (1) your Outlook calendar appointments/meetings, (2) your activity in the Teams app itself (such as presenting in a meeting or in a Teams call) and obviously (3) the system state – active, sleeping, idle and as such.


2 Answers

For anyone still interested, there's a new API available that allows to set user presence with application permission type.

https://learn.microsoft.com/en-us/graph/api/presence-setpresence?view=graph-rest-1.0&tabs=http

I've tested it and it seems to "mostly" work. I've observed 2 issues:

  1. user for whom the presence is set, does not see an update in their teams client (both desktop/web/mobile). Other people see the status is changed though.
  2. Setting Away/Away does not work - status is changed to Available/Available.

So although it's in 1.0 version, for me it's still more beta.

like image 137
Łukasz Zwierko Avatar answered Nov 10 '22 05:11

Łukasz Zwierko


Lukasz was correct, only thing is you need to provide bearer token as well in the header for authorization

curl --location --request PUT 'https://presence.teams.microsoft.com/v1/me/forceavailability/' \--header 'Authorization: Bearer your_token_here --header 'Content-Type: application/json' \--data-raw '{    "availability": "Busy"}'
like image 23
user2739602 Avatar answered Nov 10 '22 04:11

user2739602