Before we can use this script, please follow this steps at the office 365 admin portal.

You have to do this one time.

• Login to Office 365 portal and go to ‘Exchange Admin Center’. 
• Select the ‘Permissions’ tab and under ‘Admin Roles’, add the Office 365 Administrator as a member of Discovery Management, Recipient Management, Compliance Management and Organization Management. 
• Under Discovery Management, make sure to add the roles for Mailbox Search and Mailbox Import Export



$sessionPS = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $userCredentialEO -Authentication Basic -AllowRedirection -WarningAction SilentlyContinue 
Import-pssession $sessionPS -DisableNameChecking -AllowClobber 
$targetmailbox = "" 
$targetfolder = "Target Folder" 
$usertomove = "" 
Search-Mailbox –Identity $usertomove –TargetMailbox $targetmailbox –TargetFolder $targetfolder 
Remove-pssession $sessionPS