【问题标题】:What is the maximal size of an ItemView in EWS?EWS 中 ItemView 的最大尺寸是多少?
【发布时间】:2012-09-30 13:58:18
【问题描述】:

ViewSize 在构造函数级别指定。我找到了the documentation for the constructor,但没有说明最大尺寸有多大。

【问题讨论】:

    标签: c# exchange-server exchangewebservices ews-managed-api


    【解决方案1】:

    限制为 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 的限制......
    • 嗨,@sLw 很抱歉,我不再追求交换服务器开发,所以我无法进一步 cmets 或评估你的说法。如果您认为我的答案已经过时(如 2013 年发布的),请随时更新或创建新答案。
    • 我使用 Raja 下面的答案修复了它。它每隔 1000 条记录就会遍历一次;)
    【解决方案2】:

    您可以在 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;
                }
            }
    

    【讨论】:

    • 谢谢!!这对我很有帮助
    【解决方案3】:

    Exchange 中的默认策略将页面大小限制为 1000 个项目。将页面大小设置为大于此数字的值没有实际效果。应用程序还应考虑这样一个事实,即 EWSFindCountLimit 限制参数值可能会导致为发出并发请求的应用程序返回部分结果集。

    http://msdn.microsoft.com/en-us/library/office/jj945066(v=exchg.150).aspx

    【讨论】:

      猜你喜欢
      • 2015-01-22
      • 2011-02-05
      • 2011-07-25
      • 1970-01-01
      • 2011-10-12
      • 2013-04-13
      • 2021-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多