Solved

Make calendar event private based on category

Posted on 2010-09-16
8
495 Views
Last Modified: 2014-11-12
I sync my google calendar with my corp Outlook account.  All items that sync from my google calender come in with a category of "Family".  I would like to mark these items as private in my Outlook calendar so they can not be seen by those who I share my calendar with.  
0
Comment
Question by:cobianna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 76

Expert Comment

by:David Lee
ID: 33696636
Hi, cobianna.

Let me start by saying that I've no experience using Outlook with Google calendar.  Depending on how that sync process works it might be possible to do this automatically with a bit of code.  If that doesn't work, then it's possible to do it with a bit of code, but it won't be automatic.  You'll have to run the code manually.  Interested?
0
 

Author Comment

by:cobianna
ID: 33700583
Hi BlueDevilFan!

I'm absolutely interested in the code route.  
0
 

Author Comment

by:cobianna
ID: 33720068
Hi BlueDevil Fan!

I hadn't hear back from you in a while.  Just wanted to check in with you to see if you are still able to help me.
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 76

Expert Comment

by:David Lee
ID: 33742183
Hi, Cobianna.

Sorry to be so slow.  Here's the code.  It comes in two parts.  This is part #1.  

Follow these instructions to add the code to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  Right-click on Class Modules, select Insert > Class Module
5.  In the Properties panel click on Name and enter FamilyAppts
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor


Private WithEvents olkFolder As Outlook.Items

Private Sub Class_Initialize()
    Set olkFolder = Outlook.Application.Session.GetDefaultFolder(olFolderCalendar).Items
End Sub

Private Sub Class_Terminate()
    Set olkFolder = Nothing
End Sub

Private Sub olkFolder_ItemAdd(ByVal Item As Object)
    FamilyCheck Item
End Sub

Private Sub olkFolder_ItemChange(ByVal Item As Object)
    FamilyCheck Item
End Sub

Private Sub FamilyCheck(olkItem As Outlook.AppointmentItem)
    Dim arrCats As Variant, varCat As Variant
    arrCats = Split(olkItem.Categories, ",")
    For Each varCat In arrCats
        If LCase(varCat) = "family" Then
            If olkItem.Sensitivity <> olPrivate Then
                olkItem.Sensitivity = olPrivate
                olkItem.Save
            End If
            Exit For
        End If
    Next
End Sub

Open in new window

0
 
LVL 76

Expert Comment

by:David Lee
ID: 33742201
This is part #2.

Follow these instructions to add the code to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the Code Snippet box and paste it into the right-hand pane of
5.  Outlook's VB Editor window
6.  Edit the code as needed.  I included comment lines wherever something needs to or can change
7.  Click the diskette icon on the toolbar to save the changes
8.  Close the VB Editor
9.  Click Tools > Macro > Security
10. Set the Security Level to Medium
11. Close Outlook
12. Start Outlook
13. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

Dim objFamilyAppts As Object

Private Sub Application_Quit()
    Set objFamilyAppts = Nothing
End Sub

Private Sub Application_Startup()
    Set objFamilyAppts = New FamilyAppts
End Sub

Open in new window

0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 33742221
I'm not sure that this code will work with a Google calendar sync and since I don't use Google myself I can't test it.  The approach I've taken here is to watch the calendar for adds and changes.  When one occurs the code checks to see if the added/changed item is a member of the "Family" category.  If it is, then it sets the appointment to "private".  What I don't know is if the Google calendar sync triggers the events raised by a normal item add/change.  If it doesn't, then this won't work and I've no suggestions on how to proceed.
0
 

Author Closing Comment

by:cobianna
ID: 33744955
Thanks for your help.  Worked great.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 33745270
You're welcome.  Glad I could help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Lost emails in Outlook 18 65
Exchange 2013 on premise  mailbox  issue 2 66
Migrating emails from desktop Outlook to Exchange online 3 52
email adress opens in chrome 13 62
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this step by step procedure, you will come to know the details of creating an Outlook meeting in 2007, 2010, 2013 & 2016.
This Micro Tutorial demonstrates the importance of annotations in Google Analytics and how they should be used to document changes made to a site, Google updates (Ex: Panda & Penguin), marketing campaigns, and any other events that might have contriā€¦
This Micro Tutorial will demonstrate common damaging and frequent mistakes I see in most analytic audits. Most of them are campaign tagging mistakes, so this video will break it down into simple steps.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question