How to delete mailbox content in Office 365 or Exchange
1. Enable “Mailbox Import Export” role
- Connect to Office365 Portal.
- Select Admin -> Exchange.
- Click on Permissions.
- Double-click on Organization Management.
- Under Roles, click on the plus sign (+).
- Add the Mailbox Import/Export role.
- Then ensure that your account is a member of the Organization Management.
1.2 Add permissions with Powershell
you can also use the following cmdlet to add the described above permissions:
New-ManagementRoleAssignment -Name "Import Export Enterprise Support" `
-User "[Admin Identity]" `
-Role "Mailbox Import Export"
2. Delete the content of a mailbox
This will delete all content (mails, contacts, calendars).
To verify, you can issue the command :
Get-MailboxFolderStatistics -Identity firstname.lastname@example.org | Select FolderPath,ItemsInFolder
Search-Mailbox -Identity "John Doe" -DeleteContent