Group Add

The GroupAdd event occurs after a group has been added to an Outlook Bar, either because of a user action or through program code. The following example adds shortcuts for all the members of a distribution list named Shared Calendars to a new group named Workgroup Calendars. All the members of the Shared Calendars distribution list must grant at least Reviewer permission on their calendar folders for this example to work correctly.

Private Sub colOutlookBarGroups_GroupAdd(ByVal NewGroup As OutlookBarGroup) DebugWrite "OutlookBarGroups GroupAdd " & NewGroup.Name Dim myFolder As Outlook.MAPIFolder Dim myRecip As Outlook.Recipient Dim myDL As Outlook.DistListltem On Error Resume Next

Set myFolder = objNS.GetDefaultFolder(olFolderContacts) Set myDL = myFolder.ltems("Shared Calendars") For i = 1 To myDL.MemberCount Set myRecip = objNS.CreateRecipient(myDL.GetMember(i).Name) myRecip.Resolve If myRecip.Resolved Then Set myFolder = _

objNS.GetSharedDefaultFolder(myRecip, olFolderCalendar) End If

NewGroup.Shortcuts.Add myFolder, "Calendar -" & myRecip.Name Next

NewGroup.Name = "Shared Calendars" End Sub

Was this article helpful?

0 0

Post a comment