Outlook: How to access other contact folders?

Some people have several lists / folders in Outlook in the "Contacts" section (for example, except for "Contacts" and "Recommended Contacts", people can add new "folders" of contacts).

Now, my questions are:

  • How can I get a list of all these lists / folders?
  • How can I access all contacts in any of these folders?

I know that if I want to access contacts from the main Contacts list, the code is as follows:

   MAPIFolder oMAPIFolder = 
              oNmSpc.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
   oItemsTemp = oMAPIFolder.Items;

What does it look like when accessing other contact lists / folders?

Thank!

+3
source share
1 answer

To access the Recommended Contacts folder, follow the same steps as for a contact, but

outlook := CreateOLEObject('Outlook.Application');
  NameSpace := outlook.GetNameSpace('MAPI');
  ContactsRoot := NameSpace.GetDefaultFolder(olFolderContacts) ;

outlook := CreateOLEObject('Outlook.Application');
  NameSpace := outlook.GetNameSpace('MAPI');
  SuggestedContactsRoot := NameSpace.GetDefaultFolder(olFolderSuggestedContacts);

olFolderSposedContacts 30 () $0000001E

, Delphi, # .

+1

Source: https://habr.com/ru/post/1783377/


All Articles