Delete items in the Recoverable Items folder in Exchange Online

One of the customers I work with apply extensive retention policies for mailboxes in the organization. A restrictive policy applied to a mailbox receiving a lot of messages with attachments will likely cause incidents where the recoverable items quota is exceeded.

In this case the root cause is retention policies but this could also be caused by litigaton hold, eDiscovery case holds etc. This article assumes it is OK to remove these policies and hard deleting the messages. If these messages need to be retained.

Before proceeding, verify that the quota is exceeded by running the below command. Mailboxes on hold have a default recoverable item quota of 100 GB.

Get-MailboxStatistics <PrimarySMTPAddress> | ft DisplayName, TotalDeletedItemSize, DeletedItemCount


Before proceeding we need to make sure that messages can be deleted from the mailbox. This involves changing some settings for the mailbox. The following command will disable deleted item retention and single item recovery for the mailbox.

Set-Mailbox <PrimarySMTPAddress> -RetainDeletedItemsFor 0
Set-Mailbox <PrimarySMTPAddress> -SingleItemRecoveryEnabled $false

You also need to ensure the mailbox is no longer affected by any holds. Microsoft explains this in detail in this article. Note that a applied retention policy starting with a minus sign means the mailbox is excluded from the policy.

As changes related to retention / holds usually take a long time to apply in large organizations I recommend waiting 24 hours before proceeding.

Deleting the items

To delete the items I grant my account access to the mailbox in question and setup a new Outlook profile for the task. I configure the profile not to use cached Exchange mode and close the Outlook client as soon as the target mailbox becomes avaialble.

Using MFCMAPI I proceed with deletion of the contents of the DiscoveryHolds folder:

  1. Start the application and select “Session” -> “Logon…”
  2. Select the newly created Outlook profile and click “OK”.
  3. Double-click the target mailbox in the list of available mailboxes.
  4. Expand the mailbox and the “Recoverable Items” folder.
  5. Right-click “DiscoveryHolds” and select “Advanced” -> “Empty items and subfolders from folder…”
  6. Check the “Hard Deletion” box and click “OK”.

The deletion process should start immediately you should see the ItemsInFolder and FolderAndSubfolderSize changing when running the command below.

Get-MailboxFolderStatistics -Identity <PrimarySMTPAddress> -FolderScope RecoverableItems | ft Identity, ItemsInFolder, FolderAndSubfolderSize

When you’re happy with the results verify that you’re under the recoverable item quota by running this again.

Get-MailboxStatistics <PrimarySMTPAddress> | ft DisplayName, TotalDeletedItemSize, DeletedItemCount

It everything looks OK make sure to re-apply the single item recovery and deleted item retention settings. Below are commands to restore defaults.

Set-Mailbox <PrimarySMTPAddress> -RetainDeletedItemsFor 14
Set-Mailbox <PrimarySMTPAddress> -SingleItemRecoveryEnabled $true

Possible issues

If deleting the items only results in the items being moved from “DiscoveryHolds” to “Purges” it most likely means the item retention and single items recovery settings are not fully applied. Wait some time and run the below command.

Start-ManagedFolderAssistant -Identity <PrimarySMTPAddress>

Update: 2021-09-07: Another reason message may be getting stuck in Purges is the mailbox property ElcProcessingDisabled being set to True. Microsofts own documentation suggest that’s the way it should be done but my experience is that setting it to false may resolve this issue (thanks for verifying Michael).

Set-Mailbox -Identity <PrimarySMTPAddress> -ElcProcessingDisabled $false
Start-ManagedFolderAssistant -Identity <PrimarySMTPAddress>

23 thoughts on “Delete items in the Recoverable Items folder in Exchange Online”

  1. Hi, thank you for effort on doing this post. I tried to follow these steps, but I ended up with following error in MFCMAPI:

    Code: MAPI_W_PARTIAL_COMPLETION == 0x00040680
    Function lpMAPIFolderToEmpty->EmptyFolder( lpProgress ? reinterpret_cast(m_hWnd) : NULL, lpProgress, ulFlags)
    File D:\a\1\s\UI\Dialogs\HierarchyTable\MsgStoreDlg.cpp
    Line 719

    1. Hi,

      I’m afraid I haven’t encountered that error. Did you find a way to get it to work?

      1. Please try after unchecking the cached mode. somehow purge works on online mode though it takes time.

    2. Are you sure the offending mailbox has been removed from all retention policies? I was running into this and forgot to remove the offending mailbox from a retention policy once I did this it worked.

  2. Ran into the same… The trouble is a a “Chicken and the eggs” I suspect… When deleting stuuf, in goes in the Recovery, but dleleting from the but’s it in the PURGE.
    I hard deleted the purge, and things started emptying itself BOTH in purge and Recovery…
    Also of note, don’t forget the delay if you had to make yourself a member of the necessary security/compliance groups.

  3. After countless Microsoft articles *and* hours on the phone with them, I somehow came across this site and it was the first with decent instructions and the only one THAT WORKED! Boss’s DiscoveryHolds folder was full at 100GB and I been losing sleep over trying to empty or expand it.
    Thank you Martin!

    1. That’s awesome, happy to hear that this helps people in the real world! Thanks for sharing 🙂

  4. This didn’t work for me. Emails simply got stuck in Purges

    Running Start-ManagedFolderAssistant -Identity did nothing either. Yesterday this command simply moved them back to DiscoveryHolds but today it does nothing and I can’t delete the purges folder and I can’t delete any emails within the Purges folder. I went through the MS guide and tried the Powershell commands with no success either. Our customer is stuck being unable to delete emails.

    1. Try changing the value (true/false) of the setting “ElcProcessingDisabled” for the mailbox using Set-Mailbox. I’ve had issues with messages stuck in purges from time to time and I have something like the above in my notes. Hope it helps and please let me know if it does so that this can be added to the post.

      1. Setting this to False worked. I worked with Microsoft tech on Friday afternoon who pointed this out. In Microsoft’s guide it says to set it to true so that’s where the confusion was.

        1. Thanks for sharing, I’ve updated the article with this now verified piece of info 🙂

    1. Are you trying to delete something you have already attempted to delete, because it visually didn’t look like it was deleting?

      I think that error means its processing your first request.
      A refresh of the folder may show it has been deleted.

  5. This article is by far the most clear instruction to cleanup Recoverable Items folder, thanks Martin. The issue I have encountered is the MFCMAPI part, it’s just stuck at “Not Responding” and did nothing while was trying to empty 100GB DiscoveryHolds folder, any idea?

    1. Thank you for those kind words, Sander! Are you sure things aren’t happening in the background when MFCMAPI is “Not responding”? I’ve encountered it quite frequently in these scenarios but by repeatedly running “Get-MailboxFolderStatistics -Identity -FolderScope RecoverableItems | ft Identity, ItemsInFolder, FolderAndSubfolderSize” over and over again you can usually see if there is any progress.

        1. The same has been happening for me, MFCMapi hangs after trying clicking OK when selecting hard delete. Event Viewer immediately reports the application has hung. I suspect some update to M365’s MAPI processing may have broken this functionality, possibly specifically for Recoverable Items.

Leave a Reply

Your email address will not be published.