How can I delete thousands of emails from multiple mailboxes?
Asked by
3MeV drift
I'm dealing with a situation where I need to delete around 2000 email items from 8 different mailboxes. I've looked into eDiscovery, which allows me to pull all the data, but it doesn't let me delete the emails. When I try connecting to Exchange Online, I'm limited to only 10 items per search. What are my options for purging these emails efficiently? Any advice would be appreciated!
Answers
Check out Microsoft's documentation on using PowerShell to delete emails. It outlines how to set up a command that can help you purge multiple items effectively. Just make sure to double-check you're using the correct parameter as sometimes it can lead to errors if it's not recognized. Itโs a bit technical, but worth it!
Reply to this answer
You can utilize the Graph API along with PowerShell, which can be effective for this. Itโs usually easier than using eDiscovery alone. Run a command to filter the emails you want to delete, and make sure to practice with a few messages first to avoid accidentally deleting important stuff!
Reply to this answer
For your task, the best approach is pairing New-ComplianceSearch with New-ComplianceSearchAction -Purge. Just narrow down your search query to keep results precise, run it, and then youโre good to go with the delete action. Remember, the key here is ensuring your query is tight to avoid unintended deletions!
Reply to this answer
If the emails are from the same source, consider doing a message trace to get an overview. Then, from the results, you can delete them all at once. This could simplify your task, especially since youโre dealing with multiple dates and senders. Just make sure you verify everything before hitting delete!
3MeV drift: That's actually a good point! I'll look into that, thanks!
Reply to this answer
I suggest doing a compliance search in the Security and Compliance Center and using the New-ComplianceSearchAction with the -Purge parameter. The 10 item limit you noticed applies to the older Search-Mailbox cmdlet, which is outdated. Compliance searches are much more powerful and can handle larger batches without that restriction.
3MeV drift: Thanks for the info! Is there a difference between SoftDelete and HardDelete in this context?
Reply to this answer
Add your answer
Answers are reviewed before publication.
+another perspective: Thanks for the tip! But when I tried using the purge command, I got an error saying the parameter cannot be found. Any ideas?