2015-10-20 91 views
1

美好的一天。EWS託管API:無法檢索聯繫人,它總是返回0

我正在使用EWS Managed Api 2.0在我的.NET 4.0應用程序中獲取Exchange 2013聯繫人。

我有一個工作交換服務器綁定。這是我的代碼。

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; 

        } 
       } 

但是當我運行的代碼中,contactItems返回0。這很奇怪,因爲我們在交往中在Exchange 2013(ITEMCOUNT = 0,TOTALCOUNT = 0)

EWS Managed API Contact is 0 Image

怎麼辦我解決這個問題? 我已將此問題發佈到Microsoft技術問題中,但沒有人回覆。

非常感謝。

回答

0

我建議你指定要在下面的行例如,修改了訪問

FolderId foldid = new FolderId(WellKnownFolderName.Contacts); 

郵箱
FolderId foldid = new FolderId(WellKnownFolderName.Contacts,"[email protected]"); 

最有可能發生的事情是你無法訪問您的期待郵箱,你也可以用ewseditor做一些測試https://ewseditor.codeplex.com/

乾杯 格倫