locked
Synchronization of Deleted Calendar Items - EWS Managed Api RRS feed

  • Question

  • Hello,

    I'm working on creating a Calendar Synchronization service that sync Appointments with custom objects that we have on our side. I am tracking the ItemId and the CleanGlobalObjectId on the items in order to find and sync when a change is made on either side.

    The problem I am having now is how to tell what Item is deleted. I am using the SyncFolderItems method to sync everybody's calendar at the office. But on the ItemChange.ChangeType, when its ItemChange.Delete all I have to work with is an ItemId that doesn't exactly match up with the corresponding ItemId that I have on my custom object.

    Is the solution to search for it in deleted items? If that is the case, what if they shift+delete something so its permanent? 
    Any help on this would be great.

    I am attempting to loop through items in the deleted items folder and the dumpster trying to match on ItemId but I'm coming up empty handed. Is the ItemId still valid for use on an item that has been deleted? 

    Thanks,
    Danny


    Monday, August 6, 2018 3:47 PM

All replies

  • When an Items moves or is deleted it will cause the ItemId to change so that is normal 

    >>Is the solution to search for it in deleted items? If that is the case, what if they shift+delete something so its permanent? 

    No by default Single Item retention should be on so anything deleted that way would go into the RetainedItems folder for the default retention period. Also for Calendar events there is a Calendar logging folder in the RetainedItems tree as well see https://docs.microsoft.com/en-us/Exchange/policy-and-compliance/recoverable-items-folder/recoverable-items-folder

     With recurring items however you won't get a deleted items as deleting and instance of a meeting will just cause a modification to the Master instance.

    Cheers
    Glen

    Monday, August 6, 2018 11:26 PM
  • Thanks for your response Glen.

    Is the ItemId returned with the ItemChange worthless on deleted items?

    Ultimately I am trying to identify the deleted item, and I'm not sure how to do that when the only piece of information that I have is the ItemId.

    Thanks,
    Danny

    Wednesday, August 8, 2018 7:37 PM
  • >>Is the ItemId returned with the ItemChange worthless on deleted items

    If the Item has been moved or deleted yes it's worthless, some updates cause the appointment to be recreated so the ItemId is not a good property to track. If you have the CleanGlobalObjectId  than you should be able to use that to find an instance or item related to that particular appointment.

    Thursday, August 9, 2018 11:18 PM
  • Thank you so much for your help. I am still having some trouble grasping how this would work. 

    I have the CleanGlobalObjectId, but my problem is I have a lot of CleanGlobalObjectIds for a lot of different appointments. So when an item gets deleted, how can I figure out what item it was. Is this possible?

    To reiterate, I have custom objects that represent objects on EWS. I am attempting to sync as closely as possible. I use the CleanGlobalObjectId in order to find and update items on EWS as changes our made through a custom built app, but when an item is deleted on EWS(via outlook or exchange online) I need to match it up to a custom object on our side within our internal application. 

    I'm hoping there might be something I can do to make this work.

    Thanks again Glen

    Thursday, August 23, 2018 2:47 PM
  • You can pull the latest deleted Items from the DeletedItems folders (or Recoverable items folders) and then reconcile that to what you are storing. Synchronization logic is unfortunately always hard and its something that you need to put a lot of effort and testing into there are now shortcuts for this. But if you have CleanGlobalObjectId  then all you need to do is reconcile against the actual data.

    Some other thing syou can do is look for the move events which will fire when an Item is moved to the DeletedItems or recoverableitems folder in Mailbox etc (then look at the parentFolderId to work out if it came from the calendar etc).

      
    Thursday, August 23, 2018 11:38 PM