Quantcast
Channel: Exchange Server 2013 - General Discussion forum
Viewing all articles
Browse latest Browse all 4521

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

$
0
0

Good day. 

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. 


Viewing all articles
Browse latest Browse all 4521

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>