I need to get all contacts and distribution lists (with their contacts) from my Outlook using Exchange WebService.
I have Visual 2017, and EWSManaged API 2.2 installed. My server has Exchange 2013, and I have installed Exchange 2013 101 Code Samples.
What I have now:
Option 1. I have that, but only 100 contacts are displayed:
var nameResolutionCollection = service.ResolveName("SMTP:", ResolveNameSearchLocation.DirectoryOnly, true);
With this NameResolutionCollection received above, how can I know if a NameResolution.Contact is a Distribution List? I can not see any property...
Option 2. I have that, but I get contacts only from Contacts folder. That folder has a 'Recipients Cache' folder, and a GAL folder, but it is empty...
FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Contacts, new ItemView(200));
Option 3. I have that, but I get all folders from Outlook (such as Notes, Outbox, Sent Items,...)
FindFoldersResults allFolders = service.FindFolders(WellKnownFolderName.Root, new FolderView(int.MaxValue) {Traversal = FolderTraversal.Deep});
Option 4. I can get all contacts from a Distribution list, but i need the name:
ExpandGroupResults results = service.ExpandGroup("[email protected]");
I have seen that FindPeople might help me (https://gsexdev.blogspot.com/2013/05/using-ews-findpeople-operation-in.html) BUT my project does not find that class (FindPeopleType, FindPeople, ...)
Any help? Is FindPeople the only way to get all contacts from my Outlook? Not only from Contacts folder
Thanks in advance, Diego