how to get access to Contact Group folder in Outlook 2010 VBA?
-
Tuesday, March 06, 2012 3:04 AM
in Outlook 2010, you add new contact group folder (or called distribution list from earlier version?).
I know it is easy to get the default contact folder "Contacts" as well as the "Suggested Contacts".
How about user created ones?
Ideas?
Thanks,
All Replies
-
Tuesday, March 06, 2012 9:08 AM
The process is much the same e.g as follows, where Foldername is the name of the personal folder.
Dim olNS As Outlook.NameSpace
Dim olContactFolder As Outlook.MAPIFolder
Dim olContact As Outlook.ContactItem
Dim olItems As Outlook.Items
On Error Resume Next
Set olNS = GetNamespace("MAPI")
Set olContactFolder = olNS.GetDefaultFolder(olFolderContacts).Folders("Foldername")
Set olItems = olContactFolder.Items
For Each olContact In olItems
'Do what you want here with olContact
Err.Clear
Next
Set olItems = Nothing
Set olNS = Nothing
Set olContactFolder = Nothing
Set olContact = NothingGraham Mayor - Word MVP
www.gmayor.com
- Proposed As Answer by danishaniModerator Saturday, March 10, 2012 2:59 AM
- Marked As Answer by danishaniModerator Thursday, March 15, 2012 5:22 PM
-
Tuesday, March 06, 2012 2:44 PM
olContactFolder.Parent.Folders("Foldername") works for any contact folders.- Proposed As Answer by danishaniModerator Saturday, March 10, 2012 2:58 AM
- Marked As Answer by danishaniModerator Thursday, March 15, 2012 5:22 PM

