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 (and also Microsoft Flow) 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 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.
The first step is to add the trigger for Outlook. I’ve used the following trigger:
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:
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:
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:
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:
Costs
But wait; This stuff costs money right? Absolutely. But if I look at the forecast in Azure, I see the following forecast:
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.
Top comments (0)