0

如何使用 EWS 2.0 恢复已删除的约会?我想我可以在 WellKnownFolderName.RecoverableItemsDeletions 文件夹中搜索它。但我只有ItemId。可悲的是我不能在 SearchFilter 中使用它......

什么是最好的方法?

我的尝试:

    ItemView view = new ItemView(10);

SearchFilter searchFilter = new SearchFilter.IsEqualTo(ItemSchema.Id, itemChange.ItemId);

var findResults = exchangeService.FindItems(WellKnownFolderName.RecoverableItemsDeletions, searchFilter, view);

List<ItemId> ids = null;
foreach (var findResult in findResults)
{
    Debug.WriteLine(findResult.Id.ToString());
    ids.Add(findResult.Id);
}
exchangeService.MoveItems(ids, WellKnownFolderName.Calendar);

发生错误:

{“'ItemId' 类型的值不能用作搜索过滤器中的比较值。”}

4

1 回答 1

1

Set your WellKnownFolderName to DeletedItems when you are searching for the appointments. And you should set up your search filter to only return appointments since the DeletedItems folder can hold more than just the appointments you are looking for. Here is an example that should work for you.

ItemView view = new ItemView(10);
// Only look for appointments
SearchFilter searchFilter = new SearchFilter.IsEqualTo(ItemSchema.ItemClass, "IPM.Appointment");
// Look for items in the DeletedItems folder
FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.DeletedItems, searchFilter, view);
// Move each of the deleted items back to the calendar
List<ItemId> ItemsToMove = new List<ItemId>();
foreach (Item item in results)
{
    ItemsToMove.Add(item.Id);
}
service.MoveItems(ItemsToMove, WellKnownFolderName.Calendar);
于 2014-03-17T20:32:00.963 回答