【发布时间】:2012-09-30 13:58:18
【问题描述】:
ViewSize 在构造函数级别指定。我找到了the documentation for the constructor,但没有说明最大尺寸有多大。
【问题讨论】:
标签: c# exchange-server exchangewebservices ews-managed-api
ViewSize 在构造函数级别指定。我找到了the documentation for the constructor,但没有说明最大尺寸有多大。
【问题讨论】:
标签: c# exchange-server exchangewebservices ews-managed-api
限制为 2,147,483,647,因为它的数据类型是 Int32, 如果我们通过 ItemView(2147483647);,我使用它并测试它不会返回任何错误;
只是定义了搜索项的页面大小,如果搜索项的结果多于视图页面大小,则必须执行使用ItemView偏移量的后续调用才能返回其余结果。
参考 - http://msdn.microsoft.com/en-us/library/exchange/dd633693%28v=exchg.80%29.aspx http://msdn.microsoft.com/en-us/library/system.int32.maxvalue.aspx
【讨论】:
var privateContacts = service.FindItems(WellKnownFolderName.Contacts, new ItemView(9999)); 时,它总是让我达到 1000 的限制......
您可以在 ItemView 构造函数中指定 Int32 值,但只会返回一千个项目。你必须指定一个循环来获取剩余的项目。
bool more = true;
ItemView view = new ItemView(int.MaxValue, 0, OffsetBasePoint.Beginning);
view.PropertySet = PropertySet.IdOnly;
FindItemsResults<Item> findResults;
List<EmailMessage> emails = new List<EmailMessage>();
while (more)
{
findResults = service.FindItems(WellKnownFolderName.Inbox, view);
foreach (var item in findResults.Items)
{
emails.Add((EmailMessage)item);
}
more = findResults.MoreAvailable;
if (more)
{
view.Offset += 1000;
}
}
【讨论】:
Exchange 中的默认策略将页面大小限制为 1000 个项目。将页面大小设置为大于此数字的值没有实际效果。应用程序还应考虑这样一个事实,即 EWSFindCountLimit 限制参数值可能会导致为发出并发请求的应用程序返回部分结果集。
http://msdn.microsoft.com/en-us/library/office/jj945066(v=exchg.150).aspx
【讨论】: