【问题标题】:EWS Managed API: Cannot Retrieve Contacts, it always return 0EWS 托管 API:无法检索联系人,它始终返回 0
【发布时间】:2023-03-20 00:52:01
【问题描述】:

美好的一天。

我正在使用 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 技术问题中,但尚未有人回复。

非常感谢。

【问题讨论】:

    标签: api exchange-server exchangewebservices managed


    【解决方案1】:

    我建议您在以下行中指定要访问的邮箱,例如更改

    FolderId foldid = new FolderId(WellKnownFolderName.Contacts);
    

    FolderId foldid = new FolderId(WellKnownFolderName.Contacts,"Mailbox@domain.com");
    

    很可能是您没有访问您期望的邮箱,您也可以使用 ewseditor https://ewseditor.codeplex.com/ 进行一些测试

    干杯 格伦

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-08
      • 1970-01-01
      • 2023-03-23
      • 1970-01-01
      相关资源
      最近更新 更多