How to update your Microsoft Teams status using Power Automate

How to update your Microsoft Teams status with Power Automate Desktop

If you want to update your Microsoft Teams status with Power Automate, here's what to do.

1. In Power Automate, create a new flow
2. Create and run a Power Automate flow with specific link details that sends an HTTP Request to SharePoint
3. Update Microsoft Teams without opening or even touching the app

The ability to set your Microsoft Teams status automatically can help break up your workday so you don't feel chained to your PC as you work from home. Of course, you can always go into Microsoft Teams to manually change your status, but wouldn't it be better to have the ability to change your Microsoft Teams status without ever opening the app?

Built for Microsoft 365, using Power Automate saves time by streamlining tasks and workflows through automation. No need to worry if you’ve never created or automated a workflow, or "flow," as there are many popular app templates available.

Set your status

This guide is based on a guide by Damien Bird, a Microsoft MVP who created a post on how to perform a Teams Status Update via Power Automate. I will reiterate the warning Damien Bird left at the beginning of his guide as well.

This is an undocumented method and should not be used in production flows, it works, but not all the time, and there is a limit on the number of flows you can perform per day. So, it's important to keep your expectations in check.

Here are the links as they appear in Damien Bird's post:

https://presence.teams.microsoft.com/v1/me/forceavailability
https://presence.teams.microsoft.com/v1/me/publishnote

In the USA?? Or using a US tenant? You might need to use https://noamdf.presence.teams.microsoft.com or https://presence.gcc.teams.microsoft.com or you will get a Status 301 error when the action runs.

Here's what to do to set your Microsoft Teams status in Power Automate:

1. In Power Automate, click My flows from the navigation pane on the left.
2. Click New flow.
3. Here, you have three options: Automated cloud flow, Instant cloud flow, or Scheduled cloud flow. For this example, we will use Instant cloud flow.
microsoft teams status4. Create a Flow name and click an option under Choose how to trigger this flow. For this example, we will use Manually trigger a flow. Click Create when you are finished to confirm.Microsoft Teams status
5. After you click Create, you will find your new flow is created and it starts with a manually trigger, so you must pick the next step, click Next step.
microsoft teams status
6. Search for "SharePoint" in the search box and scroll and click Send an HTTP request to SharePoint. Microsoft Teams status

Set your Microsoft Teams status

1. In the next menu, you will need to complete the HTTP request to SharePoint. Your SharePoint request should look exactly like the image below.
Microsoft Teams status
You can change your "availability" status in the body of the flow to "Available", "Busy", "BeRightBack", "DoNotDisturb", or "Away". I was unable to get the option for offline/offwork to function, so I can't include it in this guide.
2. Click Save when finished.
3. Next, your flow is ready to go, so you need to test it. It is not only recommended that you test it, but it's also required when you set up your first flow. Click Test.
Microsoft Teams status
4. At the next screen, you need to indicate how you want to test your flow, either Manually (you trigger it) or Automatically (based on a previous run of another flow). Select Manually, the only choice at first flow setup. Click Test to confirm.Microsoft Teams status
5. Depending on your permissions level, Power Automate may prompt you to sign into your Microsoft account to confirm your permissions to make the flow function. As indicated, I am ready to go because I already have the necessary permissions already as designated by the green check mark. Click Continue.
Microsoft Teams status
6. Finally, click Run flow to run the flow.
microsoft teams status
Once you click Run you will see a green check mark showing that your flow successfully started with a link to check the flow status on the Flow Runs Page. You can also check your Microsoft Teams status to see if it changed when you ran the flow.

Set your status message

To set your status message, you just need to create another Power Automate flow almost identical to the one above, except for a couple of changes. Here's what your flow should look like.
MICROSOFT TEAMS STATUS

Create a custom Microsoft Teams status connector

While looking up content for this guide, I came across a really cool Spotify project by another Microsoft MVP, Loryan Strant. It takes a Spotify custom connector with a thorough guide created by That API Guy and updates their Microsoft Teams status to show what song and artist they are listening to on Spotify.

After following along with his guide, I found that another Microsoft MVP, Luise Freese provided a more efficient solution for the flow. So, my end result is a combination of both of their combined work combined with trial and error. Their guides were missing important explanations of dynamic values and expressions and what they do, but their guides are not meant for new Power Automate users either. After following both their guides, I created a Spotify custom connector with Microsoft Teams that aligns more with Freese's solution, but if you have an even better solution, please share it.

If you are looking for an easier option, copy the code exactly as it appears below to either:
1. Set your Microsoft Teams status to Away
{"id":"6e453f83-f22d-4715-bdb6-5cbe7b44b6fa","brandColor":"#036C70","connectionReferences":{"shared_sharepointonline":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/5d9bafd92370456789caa39b6c3f2277"}}},"connectorDisplayName":"SharePoint","icon":"https://connectoricons-prod.azureedge.net/releases/v1.0.1554/1.0.1554.2707/sharepointonline/icon.png","isTrigger":false,"operationName":"Set_Microsoft_Teams_status_to_Away","operationDefinition":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"HttpRequest","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"https://presence.teams.microsoft.com","parameters/method":"PUT","parameters/uri":"/v1/me/forceavailability","parameters/headers":{"content-type":"application/json"},"parameters/body":"{\n\n\"availability\": “Offline”, \n\"activity\": “OffWork”\n\n}"},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{},"metadata":{"operationMetadataId":"e3433a3c-7e7c-40d5-b804-696b2b1d0398"}}}

2. Update your status message note
{"id":"638a81c6-7d9b-481a-8875-97a08dcf18b7","brandColor":"#036C70","connectionReferences":{"shared_sharepointonline":{"connection":{"id":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline/connections/5d9bafd92370456789caa39b6c3f2277"}}},"connectorDisplayName":"SharePoint","icon":"https://connectoricons-prod.azureedge.net/releases/v1.0.1554/1.0.1554.2707/sharepointonline/icon.png","isTrigger":false,"operationName":"Set_Microsoft_Teams_status_message_note_","operationDefinition":{"type":"OpenApiConnection","inputs":{"host":{"connectionName":"shared_sharepointonline","operationId":"HttpRequest","apiId":"/providers/Microsoft.PowerApps/apis/shared_sharepointonline"},"parameters":{"dataset":"https://presence.teams.microsoft.com","parameters/method":"PUT","parameters/uri":"/v1/me/publishnote","parameters/headers":{"content-type":"application/json"},"parameters/body":"{\n\n\"message\": \"I am away from my desk. I went to grab lunch\"\n\n}\n "},"authentication":{"type":"Raw","value":"@json(decodeBase64(triggerOutputs().headers['X-MS-APIM-Tokens']))['$ConnectionKey']"}},"runAfter":{},"metadata":{"operationMetadataId":"05f65dba-6bef-458a-81ac-b4fc08c290db"}}}

You can paste it straight into Power Automate by going to New step > My clipboard. Paste it directly to the clipboard when you set up your Power Automate account.How to update your Microsoft Teams status using Power Automate - OnMSFT.com - March 10, 2022If you have any questions or need any help setting up this flow, have advice, or can give me input to make a better flow, please reach out to me on Twitter.

Share This Post:

Older

Halo Infinite launches limited time Tactical Ops event

You can now run Windows 10 on the Steam Deck, with some limits

Newer