Before migrating to Microsoft 365 I had no issues moving a mail item, using VBA, from a personal inbox to a public folder.
With the change, the following movement of mail items work:
- Shared Mailbox >> Shared Folder
- Shared Mailbox >> Public Folder
- Shared Mailbox >> Private Folder
But these do not:
- Private >> Shared Folder
- Private >> Public Folder
The error I get is:
Run-time -2147221211 (80040125) Changes made to the item were lost due to a reconnect with the server
This certainly seems like a permission issue. Anyone know what security policy governs moving a mail item from a personal mailbox folder to another public folder or shared mailbox folder?
The move fails regardless of how the current mail item is accessed:
Set Item = ActiveExplorer.Selection.Item(I)
or
Set RecipientA = objectNS.CreateRecipient("[email protected]")
Set RecipientA_Items = objectNS.GetSharedDefaultFolder(RecipientA, olFolderInbox).Items
Set Item = RecipientA_Items(1)
Here is the test code:
Set RecipientA = objectNS.CreateRecipient("[email protected]")
Set MyInbox = objectNS.GetSharedDefaultFolder(RecipientA, olFolderInbox)
Item.Move MyInbox.Folders("Test") 'This Works (subfolder in my mailbox)
Set PublicRoot = objectNS.GetDefaultFolder(olPublicFoldersAllPublicFolders)
Set PubCorrespFolder = PublicRoot.Folders("MyCompany").Folders("Processed").Folders("PCorrespondence")
Item.Move PubCorrespFolder ' This Fails (Public Folder)
Set RecipientB = objectNS.CreateRecipient("[email protected]")
Dim SharedInbox As Outlook.folder
Set SharedInbox = objectNS.GetSharedDefaultFolder(RecipientB, olFolderInbox)
Item.Move SharedInbox 'This fails (shared mailbox)`