Automatisera ett statusmeddelande i Microsoft Teams baserat pÄ en kalenderhÀndelse/kalenderbokning.
A quick googling led me to a youtube video that led me to the post (where the video is available)
https://www.damobird365.com/teams-status-update-via-power-automate/
However, since I havn’t used Power Automate it was a little tricky to understand exactly how to make this work but I found another post describing almost what I wanted (however the details were not worth linkning to)
This is what I ended up with.
- In Outlook – A scheduled event/meeting reoccuring on the days I normally work from remote; with a specific subject (it should be a text that doesn’t conflict with other events that might end up in your calendar)
- In Power Automate – An automated scheduled work flow; that tries to find my event with subject ”working from remote”.
- If it finds the event my Teams status is set to ”working from remote today 2022-12-02” (where the date is the current date)
- If it doesn’t find the event my Teams status is cleared.
Creating the work flow (prerequisite)
(If you know how to add a Flow, you can scroll down to ”The Steps”)
Open Power Automate from your Office 365 menu (”App window”)
- The App menu is found in the top left corner
2. Power Automate is found in the list of apps
(if you can’t see it, open ”all apps”)
3. In Power Automate, open ”My flows”
and select ”New Flow”
4. From the menu, select ”Scheduled …”
5. In the dialog, set the name of your flow and schedule it to run once a day at 8 AM.
Now your Flow is created and you can continue with adding the steps as follows below
The Steps
- Starting with a Scheduled trigger (starting at 08:00 Swedish Stockholm time), running once (1 interval) every day (frekvens/frequency)
2. Add a component ”Calendar view of events (V3)” ,
We use it to find the calendar event* to trigger the next step (condition) for setting my Teams status message.
*with subject ”working remote today” (”arbetar pĂ„ distans” in Swedish)
Start time (starttid) function: adddays(utcnow(),0,’yyyy-MM-dd’)
this creates the current date att 00:00
End time (Sluttid) function: addMinutes(addHours(adddays(utcnow(),0,’yyyy-MM-dd’),23),59)
this creates the current date at 23:59
Search (Sök) : the text to search for in subject and body.
TIP: (note that this might cause an error if you have the same phrase in another meeting events subject or body, therefore it might be good to use a more explicit text like ”WORKING_REMOTE”
3. Add a component of type ”Condition”
Set a Condition: if length of output from calendare events is 1 , it is a ”Yes (Ja)”, else it isa ”No (Nej)”
the condition looks like this. length(outputs(’Find_Calendar_Entry’)?[’body/value’])
where Find_Calendar_Entry is the name of the previous component (without the underscores)
”Ă€r lika med” means ”is equal to”
4. Add the two (Yes/No) steps – to update Teams status message
Here we Use the component ”Send HTTP – request to sharepoint”
(note: this could be simplyfied if a component/step would create the ”status message” as output from the control ”If Found set status – else clear status” and then used as input in one ”set Teams status message”, pleace write to me on linkedin if you have a correct solution – https://www.linkedin.com/in/jimi-lee-friis-b729155/
They both look the same here except for the ”message” part.
the timestamp/day looks like this: adddays(utcnow(),0,’yyyy-MM-dd’)
and creates a short date (the addDays is just used to format the output)
Configuration of the sharepoint HTTP request.
Web address (base address): https://presence.teams.microsoft.com"
Method: Put
URI: v1/me/publishnote
Headers: content-type | application/json
Message
{
"message": "Jobbar pÄ distans @{adddays(utcnow(),0,'yyyy-MM-dd')} <pinnednote></pinnednote>",
}
//Note: the tag "pinnednote" will mark the check "Show when people message me"