none
how to get access to Contact Group folder in Outlook 2010 VBA? RRS feed

  • Question

  • 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,

    Tuesday, March 6, 2012 3:04 AM

Answers

  • olContactFolder.Parent.Folders("Foldername") works for any contact folders.
    Tuesday, March 6, 2012 2:44 PM
  • 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 6, 2012 9:08 AM

All replies

  • 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 6, 2012 9:08 AM
  • olContactFolder.Parent.Folders("Foldername") works for any contact folders.
    Tuesday, March 6, 2012 2:44 PM
  • Hello to evrybody,
    I find out this article by google and i hope someone can help me to solve a issue abaout outlook folders and store.

    I work around a program to maanege contact for my customer, he has 4 differte PST file with 4 different contact folder (3 are normal PST 1 is a particular PST used in a contact share program).
    If I use just 

    ns.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)

    I can't see the contact in the other PST differt by default.

    I findout a method to see all Archive attached to Outlook Session:

    ns.stores (by a loop a can see ID and Displayed Name)

    but there aren't any way to access to it and get Contact folder.

    Some one can help me to solve this issue?

    My mail is michele@nsmsolutions.it

    Iacobino Michele Il mio motto: L' 80% dei problemi dei PC sono tra seggiola e mouse, quindi viva gli utonti che ci danno lavoro.

    Thursday, January 23, 2014 2:01 PM