Closed bertrandpons closed 1 year ago
That message can only be shown if there was no response to the batch copy request, though I'd have expected a more useful error too. It's odd that the script would reach that point, especially for only two items.
Can you try with a batch size of 1 and see if that works? -BatchSize 1
Would also be worth enabling the trace file (-TraceFile c:\temp\trace.txt
) to see what is being sent to/received from Exchange.
@David-Barrett-MS I get the same result.
I did not mention, but I want to move items from one shared mailbox to another one. I don't think there is any impact.
@David-Barrett-MS do you have any idea on the cause of this behavior? Thank you.
This won't work. You are using application permissions (impersonation), which means that the script impersonates the source mailbox (shared1). When it attempts to copy, it is still impersonating shared1, and the shared1 does not have permission to access shared2 (so the folder not found error is returned).
You can't copy or move items between shared mailboxes using impersonation. The source mailbox would need to be converted to a user mailbox, and then that user granted FullAccess rights to the second shared mailbox.
Alternatively, you could try using delegate flow and logging in as a user with permission to both mailboxes (I haven't tested that, but in theory I think it will work).
Hello @David-Barrett-MS,
Thank you for your great scripts!
I have run the following command:
.\[Merge-MailboxFolder.ps1 -SourceMailbox <SOURCE_MAILBOX> -TargetMailbox <TARGET_MAILBOX> -TargetArchive -MergeFolderList @{"Inbox"= "WellKnownFolderName.Inbox"; "Sent Items"= "WellKnownFolderName.SentItems"} -ProcessSubfolders -CreateTargetFolder -Office365 -Impersonate -OAuth -OAuthClientId <OAUTH_CLIENT_ID> -OAuthTenantId <OAUTH_TENANT_ID> -OAuthSecretKey <OAUTH_SECRET_KEY> -Copy -LogFile ./test_mailboxmerge2.log
If I check the target, I notice that the folders are created, but, although logs show that items are copied:
"2 items found; attempting to copy No results returned - assuming all items processed"
I don't see the contents in the folders.
Do you have any idea?
Thank you and best regards,
Bertrand Pons