locked
Move emails from between Shared Mailboxes based on date RRS feed

  • Question

  • Hi all,

    I am trying to move emails from one shared mailbox to another based on date.

    I have run the below but of course the "Search-Mailbox" cmdlet only does 10000 at a time - also this appears to only copy, and not move the emails.

    $SourceUserName="7fb044c9-11b6-4caf-8fa6-e36861eb738a";
    $TargetUserName="dc5173ae-ff39-4902-89f6-b5d166f9ee48";
    $TargetFolderName="Archive";
    $Fromdate ="01/01/2017";
    $Todate = "01/01/2018";
    $date="Received:"+$Fromdate+".."+$Todate
    Search-Mailbox $SourceUserName -SearchQuery "$date" -TargetMailbox "$TargetUserName" -TargetFolder "$TargetFolderName" -LogLevel Full


    Can someone please assist? I've tried the New-MailboxSearch option as per below and all it does is create the search, but does not move or copy any emails.

    New-MailboxSearch -Name "Sales AU Archive" -SourceMailboxes 7fb044c9-11b6-4caf-8fa6-e36861eb738a -TargetMailbox dc5173ae-ff39-4902-89f6-b5d166f9ee48 -EndDate "01/01/2018"

    Thanks in advance

    • Moved by Bill_Stewart Tuesday, December 18, 2018 12:27 AM This is not "scripts on demand"
    Thursday, October 11, 2018 11:37 PM

All replies

  • There is no "move" command.


    \_(ツ)_/

    Thursday, October 11, 2018 11:48 PM
  • Ok - so how do I 'move' the emails? copy then delete? 

    There are a lot more than 10000 emails I would like to 'move' - but I can't figure out how to have the new-mailboxsearch command do a copy, let alone a copy and delete....

    Friday, October 12, 2018 12:01 AM
  • The following will give you some background and pointers on moving mail items between mailboxes:

    https://www.jijitechnologies.com/blogs/copy-move-emails-between-office365-mailboxes-using-powershell


    \_(ツ)_/

    Friday, October 12, 2018 12:09 AM
  • I've tried that - and again it uses the search-mailbox cmdlet which only allows a max of 10,000 results. I've got a few hundred thousand to move. 
    Need to use the new-mailboxsearch cmdlet - but I can't work out how to have this cmdlet copy (let alone copy/delete) between mailboxes.
    Friday, October 12, 2018 12:21 AM
  • If you don't read the documentation carefully you will not understand.

    Just copy/delete in a loop until the search returns no more items.


    \_(ツ)_/

    Friday, October 12, 2018 12:22 AM