none
EWS Managed API: Cannot Retrieve Contacts, it always return 0 RRS feed

  • Question

  • I am using EWS Managed Api 2.0 to get the Exchange 2013 Contacts in my .NET 4.0 Application. 

    I have a working exchange server binding. here is my code, and the properties of the contactfolder object.

                       
       FolderId foldid = new FolderId(WellKnownFolderName.Contacts);
    
                        ContactsFolder contactfolder = ContactsFolder.Bind(exservice, foldid);
                        ItemView view = new ItemView(500);
                        view.PropertySet = new PropertySet(BasePropertySet.IdOnly);
    
                        // Request the items in the Contacts folder that have the properties that you selected.
                        FindItemsResults<Item> contactItems = exservice.FindItems(foldid, view);
    
                        // Display the list of contacts. (Note that there can be a large number of contacts in the Contacts folder.)
                        foreach (Item item in contactItems)
                        {
                            if (item is Contact)
                            {
                                Contact contact = item as Contact;
    
                            }
                        }

    But when i run the code, i get 0 contacts, which is strange because we have lots of contacts in Exchange. 

    I don't know why the Contacts folder is returning 0. 

    How do i solve this? Thanks for your help. 

    Wednesday, October 21, 2015 5:39 PM

All replies