Author Posts

June 28, 2015 at 11:29 pm

Hi there,

I'm looking at a clients exchange where they have a mailbox with large amounts of emails,

I need to delete all the mails in a specific folder.I tried the following one liner and multiple like it and did not get it working

Search-Mailbox -Identity "name" -TargetMailbox "Mailboxname" -TargetFolder "foldername" -LogLevel Full -DeleteContent

Can you please help asap.

June 28, 2015 at 11:48 pm

When I run it form the exchange shell I get the following message

WARNING: The source mailbox 'mailbox' will not be searched because it is the target mailbox. The source mailbox
cannot be used as the target mailbox.

June 30, 2015 at 8:18 am

You cannot search a specific folder I believe, you can fine tune to when sent it or received

search-mailbox -identiy "Mailbox ID" -searchquery {Sent:"06/30/2015"} -deletecontent

Note the date format though