How to copy items from one mailbox folder to another mailbox folder using powershell

Ask your Windows PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
island_guy
Posts: 14
Joined: Wed Aug 14, 2013 11:07 am

How to copy items from one mailbox folder to another mailbox folder using powershell

Post by island_guy » Wed Jan 11, 2017 2:03 pm

I understand that I can copy all or supply a query using AQS but I want to only copy the contents of a Exchange mailbox folder to another Exchange mailbox folder.

Search-Mailbox

The syntax I have is:

Search-Mailbox -Identity Identity.Mailbox@abc.com -TargetMailbox Target.Mailbox@abc.com -TargetFolder "CopyContents" -LogLevel Full -SearchQuery "Folderid=LgAA42AAsdhv9eC2323SL1s/w06La4b32QA07dXtZQ23dsT4aHrSX232dsAAAVroAOAAAB AND kind:email"

And it works saying it copied 1 item(s). Just not the item I expect. The resulting item is from a different folder object. The conversation folder where I used the same ID to converse with a coworker about the ID. I expected it to only reference the folder ID that equals what was supplied but instead matched the string of the ID to an email... (kind:email) I only want it to look in the object folder ID and copy the contents.

Does anybody have anything else they can share or point out.

Thank you.

Locked