Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Pages Menu
TwitterRssFacebook

Posted by on Dec 19, 2022 in Development, Microsoft Teams

Microsoft Teams Developers can now set presence status messages via Microsoft Graph API

Microsoft Teams Developers can now set presence status messages via Microsoft Graph API

Developers have been able to change user presence programmatically for a while now, but this has been limited to just the presence availability state. In the Teams UI there is an additional place for status messages which allows a user to provide more details, and which is given prominence when communicating with that user:

Now though, there is a new API call, just for updating the status message. It’s only available in the beta endpoint and is called presence: setStatusMessage:

It’s a little confusing that this API call is separate from the setPresence call, but we’ll take it!

Note that (for now anyway) this call only accepts delegated user permissions: meaning it’s not possible to write a headless back-end application which updates 1 or more user status messages. The user will need to be present and logged in for this to work. The permission scope is the same as the one used to update presence: Presence.ReadWrite.

This might be useful for integrating into applications where the user will be dedicating a set amount of time on a certain task and doesn’t want to be disturbed – the application could automatically update the user’s presence to Busy and provide a status message explaining why the user is busy.

As well as the status message, it’s also possible to provide an expiry time after which the status message is removed. This maps to the existing functionality in the Teams UI. Note the slightly odd way of specifying the date/time and timezone separately:

It can take a little while for the status to update in the the Microsoft Teams client, but you should eventually see it reflected in the user’s status:

You can also use /me/presence/setStatusMessage

This isn’t in the documentation page anywhere, but you can also use the endpoint /me/presence/setStatusMessage to set the status message. This is actually more natural for many developers, because the permission set means that this only works against the /me user anyway!

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Share to Microsoft Teams