使用 Exchange Web 服务跨文件夹搜索 Exchange
有没有办法使用 EWS 托管 API 搜索 Exchange 中所有文件夹中的所有电子邮件。我正在使用 FindItems API 调用,但这似乎要求将搜索限制在单个文件夹中。
private void InternalPurgeProcessFolder(FolderId folderId, ExchangeService service, SearchFilter searchCriteria) {
Logger.Info("Processing folder {0}", folderId.FolderName);
int pageSize = _runtimeParameters.ExchangeRetrievalPageSize;
ItemView itemView = new ItemView(pageSize);
itemView.PropertySet = Utils.BasicPropertySet();
const int maxInterationsForTesting = 2;
int iterations = 0;
FindItemsResults<Item> findResults;
do {
++iterations;
Logger.Debug("Start of iteration {0}", iterations);
findResults = service.FindItems(folderId, searchCriteria, itemView);
_dumper.ListDatesAndSubjectsBrief(findResults);
itemView.Offset += pageSize;
} while ((findResults.MoreAvailable) && (iterations < maxInterationsForTesting));
}
Is there a way to search Exchange using the EWS Managed API for all email messages across ALL folders. I'm using the FindItems API call -- but that appears to require that the search be confined to a single folder.
private void InternalPurgeProcessFolder(FolderId folderId, ExchangeService service, SearchFilter searchCriteria) {
Logger.Info("Processing folder {0}", folderId.FolderName);
int pageSize = _runtimeParameters.ExchangeRetrievalPageSize;
ItemView itemView = new ItemView(pageSize);
itemView.PropertySet = Utils.BasicPropertySet();
const int maxInterationsForTesting = 2;
int iterations = 0;
FindItemsResults<Item> findResults;
do {
++iterations;
Logger.Debug("Start of iteration {0}", iterations);
findResults = service.FindItems(folderId, searchCriteria, itemView);
_dumper.ListDatesAndSubjectsBrief(findResults);
itemView.Offset += pageSize;
} while ((findResults.MoreAvailable) && (iterations < maxInterationsForTesting));
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
要跨文件夹查找项目,您可以创建 搜索文件夹 和 SearchFolderParameters< /a> 将 RootFolderIds 设置为邮箱的根文件夹,并将遍历模式设置为 SearchFolderTraversal.Deep。
To find items across folders you can create a search folder and in the SearchFolderParameters set the RootFolderIds to the root folder of the mailbox and the traversal mode to SearchFolderTraversal.Deep.