Sync your Outlook 365 calendar to Google Calendar with LogicApps
Tags: azure, serverless
Published: 2019-12-04 18:49:29

---
title: Sync your Outlook 365 calendar to Google Calendar with LogicApps
published: true
date: 2019-12-04 18:18:42 UTC
tags: Azure,Serverless
canonical_url: https://peterrombouts.nl/2019/12/04/sync-your-outlook-365-calendar-to-google-calendar-with-logicapps/
---

Sometimes it is hard to keep your spouse up-to-date on all the sessions and events work-related. Most of the times I’ve been able to duplicate calendar items that are relevant for my ‘better half’.

Obviously manual work makes me sad and I forget to sync some events causing a collision in the calendars. If, like me, you have kids you’ll understand this results in hoping your babysitter can make time because you forgot to add some items in your calendar **_manually_**.

## LogicApps to the rescue

[LogicApps](https://azure.microsoft.com/en-us/services/logic-apps/) (and also [Microsoft Flow](https://flow.microsoft.com/)) have connectors to both Office 365 and Google. Seems like a sure bet to get my sync going!

### Setup Google Calendar

First of all, I’ve created a **new** calendar in Google. I want to separate my personal items from work, and want the ability to enable/disable the view. A new calendar is the easiest way of doing this. Also if you share your Work calendar, the people you share your calendars with, can easily differentiate between what is work and private. Google has an excellent manual, click on [this link to follow the setup](https://support.google.com/calendar/answer/37095?hl=en) of your new calendar.

### Setup LogicApp

First, you will have to setup your LogicApp. If you don’t know how, follow [this tutorial from Microsoft](https://docs.microsoft.com/en-us/azure/logic-apps/quickstart-create-first-logic-app-workflow#sign-in-to-the-azure-portal).

The first step is to add the trigger for Outlook. I’ve used the following trigger: ![CalendarO365](https://peterrombouts.files.wordpress.com/2019/11/calendaro365.png?w=840)

This will allow me to react on added, updated and deleted events. I check this every hour, and track upcoming events 300 days in the future. Because I don’t really care about days in the past, I set that to 5 days. Adjust these to facilitate your own needs. I’ve set the interval to 15 minutes, which works for me. If you have a long interval, you could get 429 errors from Google because you’re pushing too many changes to the Calendar at once.

### Handling events

The LogicApp receives adds, updates and deletions. In my very simple sync, I add the Outlook ID to the description field of the event. Because I’m not interested (or lazy) in the actual updated info, I’ll just delete all events with the incoming ID, and create the event as new:

![ListAndDelete](https://peterrombouts.files.wordpress.com/2019/12/listanddelete.png?w=840)

So at this point any item created from Outlook is deleted.

### Insert Google Calendar items

Because we deleted the existing calendar item, we do not care if this is a update or create. The only events we can ignore are the **deleted** ones as we already deleted the calendar items. We use a switch for this:

![Switch](https://peterrombouts.files.wordpress.com/2019/12/switch.png?w=840)

As you can see, the default action is to create an event, and in the **deleted** case we simply do nothing.

The events of Outlook differ a tiny bit from the events in Google. If we zoom in on the event creation, please notice the **Z** behind the datetimes:

![CreateEvent](https://peterrombouts.files.wordpress.com/2019/12/createevent.png?w=840)

If you do not add those, Google will not accept the JSON as it will give an error on invalid data. Also seen here is the **Outlook ID** I use to identify the events coming in from Outlook 365.

### Finishing up

At this moment you can save the logic app and you are done! You can obviously do more fancypants stuff like adding more info to the events, or handling CRUD more elegantly than me, but the basics are there for you to play with!

Below is an example of my personal calendars, and the newly synced black work calendar:

![ResultCalendar](https://peterrombouts.files.wordpress.com/2019/12/resultcalendar.png?w=840)

### Costs

But wait; This stuff costs money right? Absolutely. But if I look at the forecast in Azure, I see the following forecast:

![CostsLogicApp](https://peterrombouts.files.wordpress.com/2019/12/costslogicapp.png?w=840)

It is safe to say that for less than one euro, you get alot of bang per buck!

## Conclusion

It is easy to sync your calendar using LogicApps or Flow. Using the connectors the possibilities are virtually limitless! If you have any manual operations you want to automate, look at the connectors and create your own app for automation. Have any other ideas, please share them with the community!

For the code of this app, [click here to view the gist](https://gist.github.com/prombouts/1af788011900ff0bb7d8ad548eabd8e3).