What’s the problem

Given my role at Microsoft (TSP), I generally have 2 priorities when it comes to daily work:

  1. Be in-front of customers as much as possible (those of you reading, you guys are awesome)
  2. Prepare for, or catch up from, those meetings

This means I try to not be in the office as much as possible, and run my entire life out of my outlook calendar.

When I first started, I got caught out by the “impossible travel” scenario a couple times, by team-members booking meetings I can’t possible attend. I was invited to be at opposite parts of the city at the same time or immediately one after the other, like this:

Not their fault, no one can see my calendar apart from “busy”. I kind of got sick of missing these meetings, and had to do something about it.

What’s a solution

One solution is to block out “travel” in my calendar, which works great. Since doing so, I’ve basically stopped the impossible travel situation. However, for a given week my calendar usually looks something like this:

If I spent my time manually blocking out travel for each meeting, I would end up spending all my time blocking out travel for each meeting and not actually doing anything.

I thought surely there’s a way to automate this?

Enter Logic Apps

Logic apps are one of those super cool things where I hear something new each day. Every day a colleague tells me something they can do, and I think “that is so cool, I didn’t think that was possible”.

Given their flexibility and the sheer volume of connectors for getting data and actions in and out of a given system, I was positive I could craft something for my calendar.

The process

We want to do something like this:

 WHEN a new calendar invite is received
 THAT has a location
    AND subject is NOT "Travel" (This will cause a recursive loop)
    AND timezone is "AUS Eastern Standard Time"
    Create an out-of-office "Travel" event, 30 minutes prior to invite, for a duration of 30 minutes
    Create an out-of-office "Travel" event, immediately after invite, for a duration of 30 minutes

Office 365 integration

We first must connect into our o365 tenant as ourselves (principal), for our calendar:

  • Create a new logic app
  • Click “blank app”
  • In the connectors window, choose “Office 365 Outlook”

  • In the search-box, type “event”. Select “When a new event is created (V2)”

  • Click it, click sign in. Sign in with your identity.
  • Choose your calendar, select your frequency, I’ve done 3 minutes because logic apps cost next to nothing to run.

The ‘logic’

Now we have to setup the conditional logic above, for checking for valid events. Thankfully, the location, subject and time zone are all fields automatically pulled out of the invite we can use on the fly.

  • Click new step
  • Type ‘control’, click on ‘control’, click ‘condition’
  • Add 3x rows:
    • Value: Location -> Is not equal to -> (leave this box empty)
    • Value: Subject -> Is not equal to -> “Travel”
    • Value: Location -> Is equal to -> “AUS Eastern Standard Time”

In your conditional true, insert 2x “Create event V2” Outlook steps. The tricky part is getting the “+30 minutes” time. For a given event, you have to use this expression:

  • Click the starttime or endtime field
  • Click ‘Expression’
  • Use this code:
    • addMinutes(triggerBody()?['Start'],-30) for -30mins before, note the negative 30
    • addMinutes(triggerBody()?['End'],30) for +30mins after

Instead of typing the rest, I’ll just paste a screenshot:

Seeing it in action

Below shows what it looks like in action:


  • Events that get created then modified get double/triple travel booked (but stacked parallel, so not to big to quickly delete them)
  • Events which have a meeting room get travel added

What next?

Yes, you could use Microsoft Flow to do this. This was more of a validation exercise about logic apps themselves and how much awesomeness they contain, and how easy it is to do basically anything with them. This concept could also be extended into meeting rooms etc. for intelligent management there, other o365 (or d365?) resources, on-prem resources etc. it’s really up to your imagination.

Logic apps have also recently announced isolated instances (Integration Service Environment) for vnet integration, and with biztalk vnext integration it provides a clear path forwards for on-prem connectivity and a seamless integration experience.

Overall, works perfect and requires much less administrative overhead then doing it yourself. A+ 5/5 would logic app again.