Search and delete email message quickly for every one - New method for Office 365

This method is faster than the tradition Search-Mailbox and can be used for deleting emails in short time span and a more granular report can also be generated.


You would need to be a Member of the Organization Management Role Group in Security & Compliance Center before you can run the delete email action.

Go to Content Search under Search & Investigation



Create a new Content Search,



Add the following condition for the precise result and submit the Search Request.


Wait for the search to be completed, and then Connect to Security & Compliance Center using remote PowerShell

# Get login credentials
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.compliance.protection.outlook.com/powershell-liveid -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session -AllowClobber -DisableNameChecking
$Host.UI.RawUI.WindowTitle = $UserCredential.UserName + " (Office 365 Security & Compliance Center)"

To Delete the Message run the following CMD.

New-ComplianceSearchAction "Test - Delete message from All users Mailbox" -Purge -PurgeType SoftDelete -Confirm:$false

Get the status of your Request.

Get-ComplianceSearchAction "Test - Delete message from All users Mailbox"

A report can be downloaded to get the details of the email items deleted, the report contains the useful information such as the location of the emails, the email read status, sender, subject and lots more.

This completes my post on how to quickly delete an email in office 365 for the entire organization.

Comments