Exercise - Create a flow that blocks time on your calendar

Completed

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

  1. Launch Power Automate and sign in using your organizational account.

  2. Select Templates and search for block calendar.

    Screenshot of the block calendar template.

  3. Select the Block out my Office 365 calendar for an hour tile.

  4. Verify your connection to Office 365 Outlook and select Continue.

First, we update the Create Event action from the template to find the Calendar where the event should be created. We will also set the start and end times so we only block an hour on the calendar.

  1. Select the Create Event step. Delete the string in the Calendar ID parameter by clicking the x in the right hand corner.

  2. Select the calendar you want to create an event on. For this exercise, I'm selecting Calendar.

    Screenshot showing where to click to select the calendar.

  3. Delete the Date parameter that was automatically added to the Start Time field.

  4. With your cursor in the Start Time field select the blue Dynamic Content button that appears to the right of the field. It resembles a lightning bolt. Search for the Timestamp property and select it.

    Note

    If you don't see the Timestamp property, can search for it by entering "time" in the properties search field; you can also select See More to see all of the available properties that you can scroll through.

  5. Delete the Timestamp from the End Time field. This time we'll try a formula to create a time one hour from our Timestamp. With your cursor inside the End Time select the blue fx button 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.

  6. Update the Time Zone field to match your time zone via the dropdown. It may be set to "(UTC-12:00) International Date Line West", but that may not help you in your time zone.

Here's what the updated Create Event action looks like when complete.

Screenshot of the create event action.

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).

  1. Select + Insert a new step under your Create Event step, and then select Add an action.

  2. Search for Office 365 Users and select the Get my profile (V2) action. This action provides us with the User Principal Name.

  3. Select + Insert a new step and then select Add an action again.

  4. Search for Office 365 Users and select the Get manager (V2) action.

  5. Place your cursor in the User (UPN) field and then select the Dynamic content button.

  6. In Dynamic content, find/select User Principal Name from under the Get my profile (v2) step.

    Screenshot of user principal name.

  7. Select + Insert a new step and then select Add an action.

  8. Search for Outlook and select the Send an email (V2) action.

  9. At the top right of the To input field, select Switch to Advanced Mode.

  10. Place your cursor inside of the To input field and select the Dynamic content button.

  11. In Dynamic content find/select Mail under the Get manager content.

    Screenshot of get manager mail.

  12. You can add your desired text in the Subject and the Body section. Here's an example:

    Screenshot of subject and body.

  13. Your trigger allows you to type in a custom message that you could use in your email body, but in this case we're not going to use it, so we'll make the input optional. Return to your trigger Manually trigger a flow and select the Menu dropdown to the right of the field that starts with "Hi".

  14. Select Make the field optional or you can simply Delete it altogether. Then Save your flow.

Here's an overview of the entire flow:

Screenshot of block calendar flow overview.

And here's how you can run the flow from the Power Automate mobile app:

  1. Select Instant Flows.

    Note

    If you don't see your new flow on your mobile device you can select the refresh button or pull down the list to refresh it.

  2. Select the Block out my Office365 calendar for an hour flow.

  3. Select Run Flow.

    Screenshot of block calendar flow overview in the mobile app.