Luk*_*uke 7 c# exchange-server exchangewebservices ews-managed-api
将ViewSize
在构造级别指定.我找到了构造函数的文档,但没有说明最大大小有多大.
限制为2,147,483,647,因为它的数据类型是Int32,我使用它并且还测试它如果我们传递ItemView(2147483647)则不返回任何错误;
它只是定义搜索项的页面大小,如果搜索项结果多于视图页面大小,则必须执行使用ItemView偏移的后续调用以返回其余结果.
REF - 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
您可以在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;
}
}
Run Code Online (Sandbox Code Playgroud)
小智 5
Exchange中的默认策略将页面大小限制为1000个项目.将页面大小设置为大于此数字的值没有实际效果.应用程序还应考虑到EWSFindCountLimit限制参数值可能导致为发出并发请求的应用程序返回部分结果集这一事实.
http://msdn.microsoft.com/en-us/library/office/jj945066(v=exchg.150).aspx
归档时间: |
|
查看次数: |
5206 次 |
最近记录: |