How to clear the contents of an Office 365 mailbox

Enable “Mailbox Import Export” role

  1. Connect to Office 365 Portal
  2. Select Admin -> Exchange
  3. Click on Permissions
  4. Double-click on Organization Management
  5. Under Roles, click on the plus sign (+)
  6. Add the Mailbox Import/Export role
  7. Ensure your account is a member of the Organization Management
  8. Go to Start>PowerShell right-click on it and run as Administrator
  9. Enter the following commands to connect PowerShell to Exchange Online
    1. Set-ExecutionPolicy RemoteSigned
    2. $UserCredential = Get-Credential
    3. $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
    4. Import-PSSession $Session
    5. Search-mailbox -identity USER@EXAMPLE.COMĀ – -DeleteContent -force