我尝试获取1000多个联系人,而我拥有10000多个,Microsoft EWS仅让我获取1000个项目(联系人)。ContactsFolder contactFolder = ContactsFolder.Bind(this.service,WellKnownFolderName.Contacts,new PropertySet(BasePropertySet.IdOnly,FolderSchema.TotalCount));;
ItemView view = new ItemView(contactsFolder.TotalCount);
//ItemView view = new ItemView(1000,0,OffsetBasePoint.Beginning+1);
service.TraceEnabled = false;
FindItemsResults<Item> fiResults = null;
do
{
fiResults = service.FindItems(WellKnownFolderName.Contacts, view);
PropertySet itItemPropSet = new PropertySet(BasePropertySet.IdOnly,
ContactSchema.GivenName,
ContactSchema.Surname,
ContactSchema.AssistantPhone,
ContactSchema.BusinessPhone,
ContactSchema.BusinessPhone2,
ContactSchema.CarPhone,
ContactSchema.CompanyMainPhone,
ContactSchema.HomePhone,
ContactSchema.HomePhone2,
ContactSchema.MobilePhone,
ContactSchema.OtherTelephone,
ContactSchema.Pager,
ContactSchema.PrimaryPhone,
ContactSchema.CompanyName,
ContactSchema.BusinessFax,
ContactSchema.Id);
view.Offset += fiResults.Items.Count;
} while (fiResults.MoreAvailable == true);
使用偏移量获取更多项目。Microsoft上有一篇文章介绍如何做到这一点,我什至在您的代码中看到了注释的部分。http://msdn.microsoft.com/zh-CN/library/exchange/dd633698(v=exchg.80).aspx
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句