How do I get a list of contacts using EWS? RRS feed

  • Question

  • I need to populate a drop down list with contacts using EWS.  Is there code available that shows a sample of how to do this?
    Tuesday, November 30, 2010 10:30 PM


All replies

  • I take it you mean contacts from a Mailbox's contacts folder as apposed to contacts from the Global Address list i would suggest you look at using the EWS managed API and then something like

          ContactsFolder cf = ContactsFolder.Bind(service,WellKnownFolderName.Contacts);
          ItemView iv = new ItemView(100);
          FindItemsResults<Item> fiResult = cf.FindItems(iv);
          foreach (Item cn in fiResult.Items) {
            if(cn is Contact){
              Contact cn1 = (Contact)cn;
    Wednesday, December 1, 2010 1:58 AM
  • Well Glen - its looking like it might need to be the Global Address list.  How does the code above change for the Global Address list?  (we are on Exchange 2007 SP1 if that is important to the answer)

    Wednesday, December 1, 2010 2:14 PM
  • EWS is limited in what it can do with addressbooks it has resolve operations but nothing that will enumerate the GAL its better to use LDAP and System.DirectoryServices to query AD directly something like


    • Marked as answer by swolff Friday, December 10, 2010 5:20 PM
    Thursday, December 2, 2010 5:34 AM