开发者

Exchange Managed API: Why is the event not fired when a item is deleted?

开发者 https://www.devze.com 2023-03-16 16:28 出处:网络
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

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 :/

0

精彩评论

暂无评论...
验证码 换一张
取 消