Link to home
Avatar of AXISHK
AXISHK

asked on

Remove a email for Exchange Online user

A particular email need to delete from all my Exchange Online User. Any idea how to do this ?

Thx
Avatar of Ivan
Ivan
Flag of Serbia image

Hi,

here is the guide how to bulk remove email from accounts: https://docs.microsoft.com/en-us/office365/securitycompliance/search-for-and-delete-messages-in-your-organization

Regards,
Ivan.
Apart from ComplianceSearch-related cmdlets, you can also use Search-Mailbox with the -Delete switch. Here is a detailed guide on how to perform a bulk-delete action:
How to delete email from mailboxes on Exchange 2016 / 2013 / 2010 / Online
The most important part is to correctly set the -SearchQuery, so that you target the particular email and do not delete anything else. If you use the -EstimateResultOnly switch instead of "-Delete", you will be able to see how many items are targeted.
Connect to o365 via powershell

Do you have for example the subject line of the email?  The below one liner will delete it from all of your o365 users mailboxes

Get-Mailbox -ResultSize Unlimited | Search-mailbox -SearchQuery 'Subject:"Bad Email on Deck"' -DeleteContent
Avatar of AXISHK
AXISHK

ASKER

Subject with non English chars can't be searched successfully. Do I need to install anything on my workstation ?


search-mailbox -identity johnlee -searchquery "Subject:答复:  请帮忙开通付兵的邮箱" -EstimateResultOnly
The property keyword isn't supported.
    + CategoryInfo          : InvalidArgument: (:) [], ParserException
    + FullyQualifiedErrorId : AAAC573B
    + PSComputerName        : mecmail1.mongolia-energy.com
Thx
ASKER CERTIFIED SOLUTION
Avatar of Adam the 32-bit Aardvark
Adam the 32-bit Aardvark
Flag of Poland image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial