top of page
  • Writer's pictureEd G.

Calendar Sync with Switch in Power Automate / Flow

Updated: Nov 8, 2019

This morning (as part of Step 5), I came across a situation where a user needed to sync their Google Calendar with their Office 365 Calendar as part of a bigger process. Because the new Google trigger was watching for three distinct types of event actions (New, Update, or Deleted), I knew there would need to be some kind of condition to trigger the appropriate action.

Also, since there wasn't an inherent relationship between the Google Event and the O365 Event, I would have to create one and store it somewhere. In this example, I chose Excel Online (Business), but you could use just about anything which lets you update a table.

Let's get started.

 

For the trigger, look for the Google Calendar connector, and then "When an event is added, updated or deleted from a calendar". I added a dummy action step so I could investigate the field names, as well as the options for the different event actions in the flow run history. By doing this, I found that the field I need to watch is "actiontype" and the choices are "added", "updated", or "deleted".


Since plain old "Condition" inside Power Automate, asks a question, and then branches out into a "Yes" path, or a "No" path, we'll need something that will accommodate non-binary options. For this, we'll use the Switch function.

Switch lets us look at a specific field from a previous step, and then will select a path based on the value of that field. In this example, we are looking for the "Changed Event List Items Action Type" from the Google Event trigger.

Choose the "Changed Event List Items Action Type" for your actiontype ID.

It will give you a "default" option, which it uses when it doesn't find a match...in theory. And adding options is as simple as clicking the plus sign and typing in the expected value.

Screenshot showing the Switch options and how to add them.

 

Starting with a new event, we'll want to first create the O365 event, then write both ID's to our cross reference table. Again, you don't have to use Excel...use the thing that works best for your situation and skillset.

Screenshot showing the process to add a new event in Outlook.

Here, you can see that I am using the information from the Google event to populate the required fields in the O365 event. Naturally, things can get way more complicated...like if you wanted to bring in attendees, but for now, we're just testing the concept.

Below that, I am updating the table I created in Excel to store the ID from the Google Event with the ID from the O365 Event. I also added the title/subject to make it easy to pick out if I needed to, but that is totally optional.



 

Screenshot showing the process to update an event in Outlook.

Now that we've got a connection between the two event ID's, the subsequent Update or Delete will go much easier. For update, we'll add in a step to find the right O365 Event by comparing the known Google Event ID in the Excel table.

Again, I am only filling out the required basics, but you will want to update all of the fields since I don't think Google tells you exactly what the update was.






 

For Delete, we used the same process to get the O365 Event ID and just use the appropriate Outlook action to delete the event. Note that you can also delete the row from your cross-reference table using a "Delete Row", but I tend to hang onto data so left it in.

Screenshot showing the process to delete an event in Outlook.

Now, whenever we add, change, or remove something from our Google Calendar, the same thing should happen in our Outlook calendar.

6,896 views0 comments
bottom of page