none
Public Folder Deleted Items - EWS RRS feed

  • Question

  • I'm working on a project using EWS 1.1 against an Exchange 2007 SP1 server.
    The requirement is to take Contacts defined in a specific Public Folder and replicate them to a CRM.  A record matching algorithm is defined to establish a link between the Exchange Contact and the CRM Contact.  I look in WellKnownFolderName.PublicFoldersRoot, find the specific folder I'm interested in and then execute .FindItems() to return "IPM.Contact" entities. This works without issue.

    The second requirement is to handle deletes from Exchange and mark the corresponding CRM Contact with a flag.  This is where I'm hitting my question.  I know that items deleted from a Public Folder will not show up in the deleting user's local Deleted Items folder.  I've tried executing .FindItems() in:

    • WellKnownFolderName.RecoverableItemsDeletions
    • WellKnownFolderName.RecoverableItemsPurges
    • WellKnownFolderName.RecoverableItemsRoot

    Based on what I've read elsewhere, I expected the deleted Contacts would be moved to one of these folders, but I'm not able to find anything in any of those folders.  Is there some setting on the Exchange server itself that needs to be set in order to enable these folders?  As a test, I deleted a local Contact and pointed my code to WellKnownFolderName.DeletedItems and the deleted Contact was found as expected. 

    I'm not an Exchange admin, so I'm probably missing something obvious. 
    Any help would be greatly appreciated!

    Friday, May 18, 2012 11:04 PM

All replies

    • WellKnownFolderName.RecoverableItemsDeletions
    • WellKnownFolderName.RecoverableItemsPurges
    • WellKnownFolderName.RecoverableItemsRoot

    These folders are for the Dumpter v2.0 (http://blogs.technet.com/b/exchange/archive/2009/09/25/3408389.aspx)  which is an Exchange 2010 feature so on 2007 you will only have the DeletedItems folder and each folder itself has a dumpster. EG if you shift delete the item then the Item woiuld go into the dumpster of the folder it was deleted from which you could then search for using a soft-deleted traversal in EWS.

    The other thing of note on 2007 is that you can't access (use a GetItem or Bind in the Managed API) a Deleted Item with Exchange 2007 (you can with 2010) but you can access (some) properties on the deleted Item using a FindItems soft-deleted search.

    SyncfolderItems may also help with what your trying to do http://msdn.microsoft.com/en-us/library/aa563967(v=exchg.80).aspx

    Cheers
    Glen

    Friday, May 18, 2012 11:52 PM
  • Glen,

    Thank you!  This does exactly what I was looking for.  The soft-deleted traversal of the Public Folder does indeed return the deleted Contact(s) I was looking for. 

    As you indicate, I'm not able to .Load() the deleted Contact like I can .Load() a non-deleted one, so it looks like I need to re-write that part of the code to use .GetItem() instead.  I've never worked with that method before, so I'll have to spend some time researching it.

    Friday, May 25, 2012 4:58 AM
  • Load is the same as GetItem it just the EWS Managed API abstraction of this. Unfortunately in 2007 you can't access a deleted or hidden Items (outside of a search). One workaround is to use WebDAV eg http://blogs.msdn.com/b/vikas/archive/2008/04/28/howto-webdav-ews-programmatically-recover-soft-deleted-items-from-dumpster.aspx (although on 2010 you need to remember WebDAV is gone and you need to use EWS).

    Cheers
    Glen

    Friday, May 25, 2012 5:03 AM
  • Glen,

    Thanks for your help on this.  After some discussion, the client will be migrating to Exchange 2010 in the near future, so most of this becomes a moot point - however, I'm still a bit unsure how to work with these Dumpster 2.0 folders.  Here's my scenario:

    1. I'm connecting to EWS as a "proxy" user.  This user has been given impersonation rights on all the other user mailboxes.
    2. I have a Public Folder containing Contacts
    3. User 1 and User 2 have access to this Public Folder
    4. User 1 simply presses the Delete key on their keyboard and removes a Contact from the Public Folder
    5. Contact does not show up in User 1's Deleted Items folder as expected.

    Where should I be looking for the deleted Contact?  If I instruct my code to look for the deleted Contact in WellKnownFolderName.RecoverableItemsDeletions (or any of the other RecoverableItems folders)  - do I need to have my "proxy" user impersonate "User 1" prior to examining that folder?  Am I still doing a Soft-Delete Traversal?

    Thursday, May 31, 2012 8:29 PM
  • With the dumpster v2.0 Items aren't really deleted anymore as such for example. EG If i delete and item in my contacts folder (doing a shift delete which would normally be a hard delete) what happens is the Item is moved into the RecoverableItemsDeletions. (The RecoverableItemsDeletions is just a folder under the Non_IPM_Subtree of the mailbox which means its not visible to the user but from a programmatic point of view you can just treat it as a normal folder). So if I want to recover that Item i would just do a normal FindItem operation on the RecoverableItemsDeletions folder. What you can't do in EWS is delete Items in the RecoverableItemsDeletions.

    Public folders aren't included in Single Item recovery so when Items are deleted by users they will go into the dumpster of the public folder which on 2010 you should be able to access in EWS  (with a Soft-Deleted Traversal and Get-Item) so you might be better just targeting this then looking in the users deleted Items folders (either should work in theory if your users are soft deleting the contact the it should be moved into their deleted Items folder but it won't get into the RecoverableItemsDeletions until its purged from the users deleted Items folder)

    Cheers
    Glen

    Friday, June 1, 2012 8:09 AM