Exchange
--
Questions
--
Followers
Top Experts
Remove E-mails From Public Folders
Hello Experts. Â
To remove an e-mail from all mailboxes I use this command.
Get-Mailbox | Search-Mailbox -SearchQuery "From:'XXXX'" -LogOnly -TargetMailbox administrator  -TargetFolder Inbox
and
Get-Mailbox | Search-Mailbox -SearchQuery "From:'XXXX'" -DeleteContent.
This does not hit my Public Folders. Â I am trying to write a basic command to also remove e-mails from Public Mail Enabled Folders. Â
Get-PublicFolder | Search-Mailbox -SearchQuery "From:'XXX'" -LogOnly -TargetMailbox administrator -TargetFolder \research
Cannot process argument transformation on parameter 'Identity'. Cannot convert the "\" value of type "Microsoft.Exchange.Data.M api.Public Folder Id" to type "Microsoft.Exchange.Config uration.Ta sks.Mailbo xOrMailUse rIdParamet er".
  + CategoryInfo      : InvalidData: (Microsoft.Excha...pi.Publ icFolder:P SObject) [Search-Mailbox], ParameterBin   din...mationException   + FullyQualifiedErrorId : ParameterArgumentTransform ationError ,Search-Ma ilbox
Any Suggestions ??
Thank you in advance for your assistance.
To remove an e-mail from all mailboxes I use this command.
Get-Mailbox | Search-Mailbox -SearchQuery "From:'XXXX'" -LogOnly -TargetMailbox administrator  -TargetFolder Inbox
and
Get-Mailbox | Search-Mailbox -SearchQuery "From:'XXXX'" -DeleteContent.
This does not hit my Public Folders. Â I am trying to write a basic command to also remove e-mails from Public Mail Enabled Folders. Â
Get-PublicFolder | Search-Mailbox -SearchQuery "From:'XXX'" -LogOnly -TargetMailbox administrator -TargetFolder \research
Cannot process argument transformation on parameter 'Identity'. Cannot convert the "\" value of type "Microsoft.Exchange.Data.M
  + CategoryInfo      : InvalidData: (Microsoft.Excha...pi.Publ
Any Suggestions ??
Thank you in advance for your assistance.
Zero AI Policy
We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.
have you tried this - http://technet.microsoft.com/en-us/library/ee332344(v=exchg.150).aspx
Also you might also use this to move content to different destination
http://blogs.msdn.com/b/emeamsgdev/archive/2012/04/27/powershell-script-to-move-items-from-one-folder-to-another-in-a-user-s-mailbox.aspx
Also you might also use this to move content to different destination
http://blogs.msdn.com/b/emeamsgdev/archive/2012/04/27/powershell-script-to-move-items-from-one-folder-to-another-in-a-user-s-mailbox.aspx
Hello,
I already reviewed the first site. Â
The purpose of this script is not to move but to delete a mail item from ALL public folders identified by similiar Subject or From as my example below shows:
Get-PublicFolder | Search-Mailbox -SearchQuery "From:'xxxx'" -LogOnly -TargetMailbox  administrator -TargetFolder "\Public Folders\All Public Folders\"
I can successfully run a smiliar script on the Exchange Mailboxes and it works perfectly.
Get-Mailbox | Search-Mailbox -SearchQuery "From:'XXXX'" -LogOnly -TargetMailbox administrator  -TargetFolder Inbox
When I run a Public Folder item, Â I keep getting errors. Â
I am trying to do the same thing but to the Public Folders.
Cannot process argument transformation on parameter 'Identity'. Cannot convert the "\" value of type "Microsoft.Exchange.Data.M api.Public Folder Id" to type "Microsoft.Exchange.Config uration.Ta sks.Mailbo xOrMailUse rIdParamet er".
   + CategoryInfo      : InvalidData: (Microsoft.Excha...pi.Publ icFolder:P SObject) [Search-Mailbox], ParameterBin   din...mationException   + FullyQualifiedErrorId : ParameterArgumentTransform ationError ,Search-Ma ilbox
I already reviewed the first site. Â
The purpose of this script is not to move but to delete a mail item from ALL public folders identified by similiar Subject or From as my example below shows:
Get-PublicFolder | Search-Mailbox -SearchQuery "From:'xxxx'" -LogOnly -TargetMailbox  administrator -TargetFolder "\Public Folders\All Public Folders\"
I can successfully run a smiliar script on the Exchange Mailboxes and it works perfectly.
Get-Mailbox | Search-Mailbox -SearchQuery "From:'XXXX'" -LogOnly -TargetMailbox administrator  -TargetFolder Inbox
When I run a Public Folder item, Â I keep getting errors. Â
I am trying to do the same thing but to the Public Folders.
Cannot process argument transformation on parameter 'Identity'. Cannot convert the "\" value of type "Microsoft.Exchange.Data.M
   + CategoryInfo      : InvalidData: (Microsoft.Excha...pi.Publ
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
I have discovered that deleting items from All Public Folders is not possible unless it is with a VB Script. Â With the many Public Folders existing in our organizaiton, I will open a Pay Ticket with Microsoft to see what tricks they have up their sleeves. Â I will gladly post any suggestions and resolutions from Microsoft here. Â Â Thank you .






EARN REWARDS FOR ASKING, ANSWERING, AND MORE.
Earn free swag for participating on the platform.
Exchange
--
Questions
--
Followers
Top Experts
Exchange is the server side of a collaborative application product that is part of the Microsoft Server infrastructure. Exchange's major features include email, calendaring, contacts and tasks, support for mobile and web-based access to information, and support for data storage.