Q: Can I use Exchange Web Services to get active directory listing? I am a developer on a system that connects to external customer mail servers using EWS.  This is the only direct connection we have with them.
They also occasionally send us a CSV dump of their active directory users so we can upload it into our system.
I'd like to improve this process.
If I log on to the OWA portal using the EWS credentials I can see all their corporate users under Contacts, so the information is there and accessible in some form.
Is there a way I can pull that data myself through the EWS connection (eg as an LDAP query)? and process their user records from our side?

A: It really depends on the version of Exchange the customer is running and the size of the Address book. On Exchange 2010 EWS is limited in what it can do on the Address side you have ResolveName https://msdn.microsoft.com/en-us/library/office/aa563518(v=exchg.150).aspx where you can get a maximum of 100 entries returned at a time so if you do a resolve on "SMTP:" that will return the first 100 entries in the GAL (so if its less than 100 it will work fine) if its greater than 100 than its doesn't work that well. One workaround is putting all the entries in a Group and then using Expand Group to get all the Email Address then use multiple ResolveNames to get the contact details. 
On 2013 there is the FindPeople operation https://msdn.microsoft.com/en-us/library/office/jj191039%28v=exchg.150%29.aspx which if you have the Address book Guid you can return all the entries in the GAL (Find People support paging when using the eg)
FindPeopleType fpType = new FindPeopleType();  
IndexedPageViewType indexPageView = new IndexedPageViewType();  
indexPageView.BasePoint = IndexBasePointType.Beginning;  
indexPageView.Offset = 0;  
indexPageView.MaxEntriesReturned = 100;  
indexPageView.MaxEntriesReturnedSpecified = true;  
fpType.IndexedPageItemView = indexPageView;  


fpType.ParentFolderId = new TargetFolderIdType();  
DistinguishedFolderIdType contactsFolder = new DistinguishedFolderIdType();  
AddressListIdType adList = new AddressListIdType();  
adList.Id = "2117949e-abe8-4915-91eb-6b9f867fd8de";  

fpType.ParentFolderId.Item = adList;  
FindPeopleResponseMessageType fpm = null;  
do  
{  
    fpm = esb.FindPeople(fpType);  
    if (fpm.ResponseClass == ResponseClassType.Success)  
    {  
        foreach (PersonaType PsCnt in fpm.People) {  
            Console.WriteLine(PsCnt.EmailAddress.EmailAddress);  
        }  
        indexPageView.Offset += fpm.People.Length;                      
    }  
    else {  
        throw new Exception("Error");  
    }  
} while (fpm.TotalNumberOfPeopleInView > indexPageView.Offset);  

If they are using Office365 then the Graph API a better option.
Cheers
Glen
