Reputation: 7612
Some people have a number of lists/folders in Outlook, under Contacts (e.g. besides Contacts and Suggested Contacts, people can add new "folders" of contacts).
Now, my questions:
I know that if I want to access the contacts from the main "Contacts" list, then the code looks like this:
MAPIFolder oMAPIFolder =
oNmSpc.GetDefaultFolder(OlDefaultFolders.olFolderContacts);
oItemsTemp = oMAPIFolder.Items;
How would it look like when accessing other contact lists/folders?
Thanks!
Upvotes: 3
Views: 2318
Reputation: 26
To access the "Suggested Contacts" Folder proceed exactly as you do for contact but
Instead of
outlook := CreateOLEObject('Outlook.Application');
NameSpace := outlook.GetNameSpace('MAPI');
ContactsRoot := NameSpace.GetDefaultFolder(olFolderContacts) ;
Use
outlook := CreateOLEObject('Outlook.Application');
NameSpace := outlook.GetNameSpace('MAPI');
SuggestedContactsRoot := NameSpace.GetDefaultFolder(olFolderSuggestedContacts);
Where olFolderSuggestedContacts has a value of 30 (decimal) or $0000001E in Hexadecimal
I know this is Delphi language, but adapatation to C# should be straightforward.
Upvotes: 1