EWS托管API:无法检索联系人,它始终返回0
你好 我正在使用EWS管理的Api 2.0在.NET 4.0应用程序中获取Exchange 2013联系人 我有一个工作的exchange服务器绑定。这是我的密码EWS托管API:无法检索联系人,它始终返回0,api,exchange-server,exchangewebservices,managed,Api,Exchange Server,Exchangewebservices,Managed,你好 我正在使用EWS管理的Api 2.0在.NET 4.0应用程序中获取Exchange 2013联系人 我有一个工作的exchange服务器绑定。这是我的密码 FolderId foldid = new FolderId(WellKnownFolderName.Contacts); ContactsFolder contactfolder = ContactsFolder.Bind(exservice, foldid); It
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;
}
}
FolderId foldid=新的FolderId(WellKnownFolderName.Contacts);
ContactsFolder contactfolder=ContactsFolder.Bind(exservice,foldid);
ItemView视图=新的ItemView(500);
view.PropertySet=newpropertyset(BasePropertySet.IdOnly);
//请求联系人文件夹中具有所选属性的项目。
FindItemsResults contactItems=exservice.FindItems(foldid,视图);
//显示联系人列表。(请注意,“联系人”文件夹中可能有大量联系人。)
foreach(联系人项目中的项目)
{
如果(项目为联系人)
{
联系人=作为联系人的项目;
}
}
但是当我运行代码时,contactItems返回0。这很奇怪,因为我们在Exchange 2013中有联系人。(Itemcount=0,TotalCount=0)
我如何解决这个问题?
我已将此问题发布到Microsoft技术问题中,但还没有人回答
多谢各位 我建议您在下面的行中指定要访问的邮箱
FolderId foldid = new FolderId(WellKnownFolderName.Contacts);
到
最可能发生的情况是您没有访问预期的邮箱,您还可以使用EWS编辑器进行一些测试
干杯
Glen我建议您在下一行中指定要访问的邮箱
FolderId foldid = new FolderId(WellKnownFolderName.Contacts);
到
最可能发生的情况是您没有访问预期的邮箱,您还可以使用EWS编辑器进行一些测试
干杯
峡谷