How to delete the content of a user mailbox

Problem:

You would like to delete the content of a user's mailbox in Exchange Server or Exchange Online (Office 365).

Solution:

To delete items from mailboxes on any on-premises Exchange servers, you can use a free third-party tool, MFCMAPI. Please refer to the vendor's website for details.

Additionally, in Exchange Server 2013, 2016 or Exchange Online (Office 365) you can remove a mailbox content from within ECP. See below how to do this:

  1. Log in to the Exchange admin center (EAC).
  2. Go to permissions, admin roles, select Organization Management, and click Edit (Fig. 1.).

Organization Management permissions
Fig. 1. Editing ECP permissions. 

  1. ​Click the plus (+) button in the Roles section (Fig. 2.).

349-2
Fig. 2. Editing the roles in Organization Management.

  1. Select and add:
    • Mailbox Import Export
    • Mailbox Search (Fig. 3.)

349-3
Fig. 3. Selecting additional roles in ECP.

  1. Click OK, Save and close ECP. Log out of Windows and log back in.
  2. Log in to the ems Exchange Management Shell (in the case of Exchange Online, use PowerShell).
  3. (Optional) Run the PowerShell cmdlet below to check how many items will be deleted:

    Get-MailboxFolderStatistics <mailbox-name> | Select Identity, ItemsInFolder
  4. Run the PowerShell cmdlet below to delete the mailbox content:

    ​​Search-Mailbox -Identity "<MailboxOrMailUserIdParameter>" -DeleteContent -force

    The MailboxOrMailUserIdParameter may be provided as an alias, canonical DN, display name, distinguished name and more. Please see this TechNet article for further reference.

Tip

If you want to delete the content of multiple mailboxes or are looking for more options, you may find this article helpful.