I’m not sure if this is even possible and goes beyond my PowerShell skills so hoping for some guidance (mainly to see if anyone has done something similar before).
We’ve had a request to delete particular emails by a set of search terms in a user’s mailbox in O365. We ran an eDiscovery search and export which generated a .pst file with the results.
The client now wants around 300 of the 450 results from the export deleted from his mailbox. Obviously we could do this manually but it’s time consuming.
Is there a way to do this in PowerShell? i.e. delete the 150 emails not needed from the .pst file, run a command in PS to extract the message ID for each email and then use those message IDs to scan the user’s mailbox and purge those emails.