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.
365techcaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

timgreen7077Exchange EngineerCommented:
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.
0
Saif ShaikhServer engineer Commented:
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
0
nilesh9869Commented:
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.
0
CodeTwo SoftwareSoftware DeveloperCommented:
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
0
365techcaAuthor Commented:
Looks like I got it sorted, took a backup involved MS Office 365 support

 Search-Mailbox -identity "manager@domain.ca" -SearchQuery 'kind:meetings AND to:importeduser@domain.ca' -DeleteContent

And for the mail, using Outlooks Boolean logic did the trick:

to:importeduser@domain.ca NOT distribution_group NOT manager

Thanks for the help all.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Office

From novice to tech pro — start learning today.