I am trying to fetch all contacts (Global Address List & User Contacts Folder) using EWS.
Options tried till now :
Service.ResolveName("SMTP:") - this has the limitation to fetch only first 100 characters as i wanted to get all contacts so that i can display in a grid along with paging. Also, turning on returnContactDetail = true (along with Property set specific to Contact Schema) does not return contact information like (display name, company name etc..)
NameResolutionCollection nd = service.ResolveName("SMTP:", ResolveNameSearchLocation.ContactsThenDirectory, true, new PropertySet(BasePropertySet.IdOnly, new PropertyDefinitionBase[] { ContactSchema.ParentFolderId, ContactSchema.Id, ContactSchema.DisplayName, ContactSchema.EmailAddress1, ContactSchema.EmailAddress2, ContactSchema.EmailAddress3, ContactSchema.CompanyName }));
service.FindItems(WellKnownFolderName.Contacts, new ItemView) - this only returns contacts from user's contacts folder not the global address list and also we need to resolve the email address using resolvename as emailadderess collection gives exchange formatted email address not in smtp format ([email protected]).