Purging a specific email from Exchange Online
Office 365 (Exchnage) Monday, 24 August 2020 by paul

To delete a specific email which has been sent in error you can search for it then use the search to purge the emails from Exchange Online mailboxes in your tenant.

1. Log into the Compliance Admin portal (https://compliance.microsoft.com/contentsearch) and create a new content search.

2. Run the following powershell commands to delete the search returned previously.

# Purge an emails from everyones mailbox sent in error

# Connect to powershell 
    [Parameter(Position=0, Mandatory=$true, ValueFromPipeline=$true)] 
    [string] $searchname

if ($Session.state -eq 'Broken' -or !$Session) { 
	write-host "Connecting to Exchange Online Powershell.."
	$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.protection.outlook.com/powershell-liveid/ -Credential (Get-Credential) -Authentication Basic -AllowRedirection
	Import-PSSession $Session -Allowclobber
# Connect to Sec & Comp PS

# Delete using command
New-ComplianceSearchAction -SearchName $searchname -Purge -PurgeType HardDelete

# Get Status of actions

3. There may be a delay before the search action is complete but running the Get-ComplianceSearchAction command a few times should show when it is complete.

Now the emails returned by the search will be removed from the mailboxes where they were stored. This does not remove them from mailboxes which are not in your tenant.

Add Comment
No Comments.