有没有办法使用 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));
}