Delete email acros mailbox database from specific folder

Hi,

I'd like to delete all emails from specific users folder (Inbox, Sent Items, Outbox) through specific or all mailboxes (use Get-Mailbox -ResultSize unlimited) and put it into target folder. At the moment I've used:

Get-Mailbox -ResultSize unlimited | Search-Mailbox -TargetMailbox BackupMail -TargetFolder Inbox -DeleteContent

but this delete ALL mails from all mailboxes and put it into Inbox of BackupMail mailbox. Instead of this, I'd like to delete mails from specific folder, not all mails.

Can you please advice?

Thnx

February 18th, 2014 1:06am

I don't know if what you want to do is possible.  This document:

http://technet.microsoft.com/en-us/library/jj983804(v=exchg.150).aspx

suggests that Folderid is a searchable property you can use in the SearchQuery parameter, but I don't have any idea what the value would be that you would search on.

Free Windows Admin Tool Kit Click here and download it now
February 18th, 2014 1:36am

Hi,

Base on my knowledge, I don't know of a way to delete mails from specific folder.

However,perhaps you can try to use other ways to achieve:

1.Use retention policy to achieve the goals:The similar thread for your reference:

Delete All Email from a User's Mailbox Folder

2.The Exchange Web Services Managed API may helps you to delete mails from specific folder:

Searching for items in a mailbox by using the EWS Managed API

Hope this helps!

Thanks.

 

February 19th, 2014 3:45am

Retention policy doesn't apply to Outbox policy.

I'm looking some powershell scripts...
Free Windows Admin Tool Kit Click here and download it now
February 20th, 2014 2:49pm

Hi,

If you want some scripts to achieve your goals,I recommend you post this in the script forum,there are more experts to help you:

http://social.technet.microsoft.com/Forums/scriptcenter/en-US/home?category=scripting

Thanks.

February 20th, 2014 9:13pm

I heard that Powershell script cannot delete end-users Outbox folder. Other automate way should be only through EWS scripting...
Free Windows Admin Tool Kit Click here and download it now
February 23rd, 2014 7:09pm

Resolved by Retention Tags and Retention Policy on Exchange Server
March 5th, 2014 12:32am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics