Exercise - Create a flow that blocks time on your calendar
Have you ever run into a situation where you're away from your work device for an unplanned, extended period of time? Wish you had a way to block your work calendar and let your manager know? Then this is the unit for you! In a few clicks, you can modify an existing template, and then have it available to trigger from the Power Automate mobile app.
Prerequisites
Access to Power Automate.
Access to Power Automate mobile app.
A basic understanding of Power Automate and experience with creating a flow is recommended.
Open the template
Launch Power Automate and sign in using your organizational account.
Select Templates and search block calendar.
Select the Block out my Office 365 calendar for an hour tile.
Select Continue.
First we update the Create Event action from the template to find the Calendar where the event should be created. We also set the start and end times so it only blocks an hour on the calendar.
Select the Create Event step. Delete the string in the Calendar ID parameter by clicking the x in the right hand corner.
Select the calendar you want to create an event on. For this exercise, I'm selecting Calendar.
Delete the Date parameter that was automatically added to the Start Time field.
Type / in the Start Time field and then Dynamic Content. Search for the Timestamp property and select it.
Note
If you don't see the Timestamp property, you may need to click See More in the right hand corner of the Dynamic Content pane next to Manually trigger a flow.
Delete the Timestamp from the End Time field. Select inside the End Time field and then select the blue fx to bring up the expressions panel. Copy and paste this expression in the expressions panel and select Add.
addHours(triggerOutputs()['headers']['x-ms-user-timestamp'],1)
Note
This expression adds 1 hour from the time the flow is triggered.
Update the Time Zone field to match your time zone.
Here's what the updated Create Event action looks like.
Next, we're going to send an email notification to our manager, to do this we use the combination of Get my profile (V2) and Get manager (V2).
Select + Insert a new step and then select Add an action.
Search for Office 365 Users and select the Get my profile (V2) action. This action provides us with the User Principal Name.
Select + Insert a new step and then select Add an action again.
Search for Office 365 Users and select the Get manager (V2) action.
Type / in the User (UPN) field and then select Insert dynamic content.
In Dynamic content, select UPN. Make sure you select the UPN that is under the Get my profile (v2).
Select + Insert a new step and then select Add an action.
Search for Outlook and select the Send an email (V2) action.
Type / inside the To field and select Insert dynamic content.
In Dynamic content select Mail under the Get manager (V2).
Finally, you can add your desired text in the Subject and the Body section. Here's an example:
Here's an overview of the entire flow:
And here's what the flow looks like in the Power Automate mobile app:
Select Instant Flows.
Select the Block out my Office365 calendar for an hour flow.
Select Run Flow.