I would like when becoming an appointment sent from my personal Google Calendar or containing some keywords like the firstname of my children to have them marked in my work Outlook as private automatically.
I explain here how I have achieved this using some VBA code.
VBA Implementation
This is inspired by this post 2 Quick Tips to Auto Mark Specific Incoming Meetings as Private in Outlook - Data Recovery Blog.Main function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Appt_AutoMarkPrivate(oItem As Object) | |
If TypeOf oItem Is MeetingItem Then | |
Set oItem = oItem.GetAssociatedAppointment(True) | |
End If | |
'Change the condition as per your actual needs | |
If (oItem.SenderEmailAddress = "thierry.dalon@gmail.com") Or (oItem.ReplyRecipients.Item(1).Address = "thierry.dalon@gmail.com") _ | |
Or (oItem.ReplyRecipients.Item(1).Address = "c9e3p3airart0n2hvn9cq825i0@group.calendar.google.com") _ | |
Or (InStr(LCase(objMeeting.Subject), "emmi") > 0) Or (InStr(LCase(objMeeting.Subject), "leo") > 0) Then | |
oItem.Sensitivity = olPrivate | |
oItem.Save | |
End If | |
End Sub |
Note in the code the condition checking the on behalf Email address.
ThisOutlookSession Trigger
In the ThisOutlookSession you can setup that all incoming meeting request are checked automatically as shown below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private WithEvents objIncomingItems As Outlook.Items | |
Private Sub Application_Startup() | |
Set objIncomingItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items | |
End Sub | |
Private Sub objIncomingItems_ItemAdd(ByVal oItem As Object) | |
' Mark meeting as Private | |
' https://datanumen.com/blogs/2-quick-tips-auto-mark-specific-incoming-meetings-private-outlook/ | |
If TypeOf oItem Is MeetingItem Then | |
Call Appt_AutoMarkPrivate(oItem) | |
End If | |
End Sub |
This function is available in my Github/outlook-vba repo under the Appointment module.