Exchange Managed API: Why is the event not fired when a item is deleted?
I use pull subscriptions in exchange managed api to catch newly created, modified or deleted items. It works fine for created or modified appointments, but for some reason it doesn't work for deleted items. Here is how i created the subscription:
PullSubscription subscription = m_exchangeService.SubscribeToPullNotifications(
new FolderId[] { WellKnownFolderName.Calendar },
1440,
null,
EventType.Created开发者_运维知识库, EventType.Modified, EventType.Deleted);
subscriptions.Add(usermail, subscription);
Do I have to configure something in exchange to make it work? Does this maybe only work for hard deleted appointments, and not for appointments that moved to the deleted folder?
Items are moved to the recycle bin. Therefore, you don't get a delete notification.
Get the FolderId of the Delected Items folder by binding to it via the WellknownFolder Enumeration. Then compare the UniqueId of that folder with the unique Id of the target of the move event.
When i got a deleted contact i got a Moved event. Then i have to do this to check when a contact is deleted :
switch (outlookEvent.EventType)
{
case EventType.Moved:
var folder = Folder.Bind(subscription.Value.EwsInstance, WellKnownFolderName.DeletedItems);
if (Equals(outlookEvent.ParentFolderId.UniqueId, folder.Id.UniqueId))
{
Console.WriteLine("Moved to DeletedItems " + outlookEvent.ItemId);
}
In case of an Appointment, i got a Modified Event, then i wanted to do the some kind of code but the FolderId is not the DeletedItems but the Calendar for this one... I would be interested to see your code as the only one i see now is a try/catch :/
精彩评论