I'm looking to clean up some mailboxes in Exchange Online under Microsoft 365 by bulk deleting emails with the subject "system alerts." There are around 1,000,887 of these to remove. I explored using Purview Content Search and the purge command, but it seems limited to just 10 items per mailbox at a time, which isn't practical for my needs since we don't have the E5 or eDiscovery Premium license. What's the best supported way to efficiently manage this bulk delete?
3 Answers
If you have global admin rights, you can create a registered app to access those mailboxes. Use MS Graph to filter and retrieve emails, but managing over a million items isn't trivial. If you're open to third-party solutions, I'd recommend checking out our tool which allows for bulk deletion with a preview option. You can see it in action here: [Ytria Hard Delete Emails](https://www.ytria.com/blog/sapio365-2-2-1/#hard-delete-emails).
Another option is to set up a Power Automate flow, but I’m not sure how effective that would be for your case.
You could try out this tool: [Ews-SearchAndDelete on GitHub](https://github.com/jmartinmsft/Ews-SearchAndDelete). EWS is still supported, even though Microsoft isn't focusing on it anymore.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures