How can I search for and delete emails by subject in Exchange 365?

0
0
Asked By TechNinja42 On

I'm trying to write a PowerShell script using MSGraphConnector to find specific emails by their subject line and then delete them from mailboxes. However, I'm running into an error when using Connect-MgGraph: it says it can't bind the 'ClientSecretCredential' parameter because it can't convert my secret key string into the required type. I've spent too long on this and figured there must be a better way to do it in Exchange. I don't have Defender for Office 365. Can anyone assist me?

3 Answers

Answered By AdminWhiz123 On

You can actually use Purview Content Search for this. It’s a solid way to search and manage emails without needing to dig too deep into PowerShell.

Answered By CodeCrafters On

If you're scripting, using the dedicated PowerShell cmdlets for Purview content searches is likely the simplest approach. Otherwise, just hop on the Purview website for guidance on how to search mailbox data.

Answered By PolicyPioneer On

Honestly, I’d skip PowerShell altogether for this. Just go with eDiscovery; it’s much easier to handle.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.