简体   繁体   English

在大文件夹上使用FindItems的Exchange Web Services

[英]Exchange Web Services using FindItems on large folders

I've been trying to retrieve items for deletion out of an Outlook public folder with just over 2 million items. 我一直在尝试从刚刚超过200万个项目的Outlook公用文件夹中检索要删除的项目。 However, even with a page size of 10, FindItems takes forever to return, as if it were querying every single item in the folder. 但是,即使页面大小为10,FindItems也要花很长时间才能返回,就像在查询文件夹中的每个项目一样。 So far it hasn't returned after 2 hours. 到目前为止,两小时后仍未返回。 Is there a way to keep it from doing this? 有没有办法阻止它这样做?

var folder = GetPublicFolder(service);
folder.Load();
var items = folder.FindItems(new ItemView(10)
    {
        Traversal = ItemTraversal.Shallow
    });

Only way to retrieve items from a folder this big is to use PropertySet.IdOnly while finding the items and adjust your batch size accordingly. 从如此大的文件夹中检索项目的唯一方法是在查找项目并相应调整批次大小时使用PropertySet.IdOnly。 I was also unable to do any filtering of this without timing out. 没有超时,我也无法对此进行任何过滤。

items = folder.FindItems(new ItemView(100)
                {
                    Traversal = ItemTraversal.Shallow,
                    PropertySet = PropertySet.IdOnly
                });

service.LoadPropertiesForItems(items, new PropertySet(ItemSchema.DateTimeReceived, 
                    ItemSchema.Subject));

Then iterate over the batch and do what you will with the items while keeping what you load to a minimum. 然后遍历批处理,对项目进行处理,同时将加载的内容降至最低。 Do to being unable to filter, you can only grab the items off of the top, so to do most anything you'll need to move processed items to a separate folder between batches. 要处理无法过滤的问题,您只能从顶部抓取项目,因此要执行大多数将处理过的项目移至批次之间的单独文件夹所需的所有操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM