Last week I created a working prototype of the application I mentioned in my previous post about synchronizing an Outlook calendar with a Google calendar. As a reminder, my goal with the app is to have visibility into my work calendar, hosted in Outlook, from within my personal calendar in Google so it’s easier for me to create events in my personal calendar at times when I don’t have any work events scheduled.
Let’s go over a small change I made to the requirements before we dive into the app’s inner workings.
Switching to a Two-Calendar Approach
I initially thought about adding the work events to my primary calendar in Google. Then I thought that this would add a large number of these “work” events to my personal calendar, which would make it harder for me to have a clear view of what’s strictly personal in the personal calendar. So, I decided to change the approach and create a new calendar in Google called “Work” and add the imported work events to it. Now all I need to do in Google if I want to see only personal events, is filter out the “Work” calendar from the calendar view.
The app is a Windows console application that creates a timer and performs a few steps when the timer “ticks”. First, it makes a list with the events from the Outlook calendar scheduled to occur between now and 5 days into the future. I picked 5 days arbitrarily, but I will make this interval user-settable in the future.
After creating the Outlook list, the app makes a second list with the events in the Google calendar for the same interval. Then, it compares them and determines 3 things:
- The events in the list from Outlook don’t exist in the list from Google. These need to be imported into the Google calendar as work events.
- The events in the list from Outlook that also exist in the Google list, but need to be updated.
- The events in the Google list that do not have equivalents in the Outlook list. These need to be deleted from the Work calendar in Google.
When the app classifies the events as I described above, it places them in 3 separate lists. One holds the events that need to be imported into the Google calendar, a second list holds the events that need to be updated in the Google calendar, and a third list holds the events that need to be removed from Google.
I added logic to create an event identifier for each event imported from Outlook. The app saves this identifier into the corresponding event in the Google calendar at the time import. Later, it uses the identifier to determine if a Google event was previously imported from Outlook.
Once the three lists are ready, the app iterates through them to create, update or delete the events in the Google Work calendar as needed.
I’ve been using the app for a few days now and it has worked well. This is a screenshot of my Google calendars view, showing some of the events imported from Outlook.
In the next update about this project I will go over some considerations I made about the types of events to import from my work calendar. I will also talk about further updates to the app, which is still missing robust error handing and a few other details.