Answered 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
     
     Answered

    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 = Nothing


    Graham Mayor - Word MVP
    www.gmayor.com

  • Tuesday, March 06, 2012 2:44 PM
     
     Answered
    olContactFolder.Parent.Folders("Foldername") works for any contact folders.