Link to home
Start Free TrialLog in
Avatar of 365techca
365techcaFlag for Canada

asked on

Remove recent email imported into Outlook 2016

Tech on my team imported former employees email into Outlook 2016 (client using Office 365) instead of Opening PST file is there any way to batch remove the contents of the PST file?

Either a search filter and pressing delete or an automated script through Office 365 powershell? Perhaps something that triggers based on massive data change,

Edit: We are also looking to remove contacts/calendar entries. Once the information is removed I will just attach the PST file to the managers Outlook Profile.
Avatar of timgreen7077
timgreen7077

No there is no way to batch remove those specific emails that was imported from that pst into the mailbox. unfortunately this will be a manual process.
As TIM suggested,

There is no way to undo.

Simply blow out or delete anything before today in Outlook, so only today's email remain then restore her emails up to yesterday from backup.  You still need a PS script to check and delete empty folders.  Then add the ex employee's pst as an additional data file.

Here are some PS scripts you can use to delete empty folders: https://social.technet.microsoft.com/forums/scriptcenter/en-US/8210b3a0-9605-446c-8e84-b68e5ae01e38/powershell-checking-for-empty-folders-and-deleting
There could be possibility to delete those mails using following article.

https://docs.microsoft.com/en-us/office365/securitycompliance/search-for-and-delete-messages-in-your-organization

As per me you need to add query TO: whose mails needs to be deleted.

Please check and try it.
You can try using Search-Mailbox with -DeleteContent switch; however, you will have to specify a very accurate -SearchQuery for that. Unfortunately, it is not possible to base the query on the "import date", still - the method has the potential to reduce the time you spend on the manual cleanup.
If you have a pre-import backup copy for this user - that would be the easiest way to go.
Here are some articles which will help you use the Search-Mailbox cmdlet.
How to delete email from mailboxes on Exchange 2016 / 2013 / 2010 / Online
Search-Mailbox (Exchange 2013, 2016, Online): Attributes
ASKER CERTIFIED SOLUTION
Avatar of 365techca
365techca
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial