Error when Running the Public Folders Mapping Script

For errors (as shown in the screenshots below) that state that the Public Folders are in 'HoldforMigration' mode when running the scripts received from BitTitan Support, the most likely reason for this is that Public Folders are being run in hybrid mode.

There are more details below, as well as the steps to run the scripts from Support. Once the scripts have completed, hybrid mode can be re-enabled.

The steps to do this are also included below. When planning to migrate legacy Public Folders to Office 365, carefully read the Public Folder Migration Guide From On-Premises Exchange 2007+ to Office 365. If the total size of the On-Premises Public Folders is greater than 20GB, the article Migrating more than 20GB of Public Folder data to Office 365 will provide the necessary steps to contact Support and request the Public Folders mapping script.

Support will then send two (2) scripts that should be run on the Exchange Online PowerShell:

  • The first script creates all the necessary Public Folder mailboxes.
  • The second script creates all the Public Folders and maps them to specific mailboxes.

If using the Public Folders in Hybrid Mode (more information in How do I enable Office 365 users to access legacy on-premises Public Folders), if the Office 365 users are still using the On-Premises Public Folders, it is not possible to create the Public Folders in Office 365. When running the script to create the mailboxes, there will be a warning stating that the newly created Public Folder mailboxes were automatically put on hold for migration, due to the fact that the Office 365 Organization has the Public Folders configured as "Remote".


When you try to run the script that creates the Public Folders, you will see the following error:


All of the Public Folder mailboxes created were put in a 'HoldForMigration' state, and therefore it is not possible to create new Public Folders on Office 365. This is caused by the fact that the Office 365 Organization has been configured to use the Public Folders in hybrid mode, so that users can access the On-Premises Public Folders. Take a quick look at the root Public Folder mailbox, by running from the Exchange Online PowerShell:

(Get-OrganizationConfig).rootpublicfoldermailbox |fl


The picture above shows that the root Public Folder mailbox is locked for migration. All other Public Folder mailboxes will also be unavailable. Now look at the Organization Configuration by running from the same PowerShell: Get-OrganizationConfig |fl *public*


The PublicFoldersEnabled attribute set to remote confirms that the Office 365 users are set to use the On-Premises Public Folders. To resolve this issue, and to be able to run the scripts and create the Public Folders on Office 365:

  1. Remove all the existing Public Folder mailboxes on Office 365, by running on the Exchange Online PowerShell: Get-Mailbox -PublicFolder |Remove-Mailbox -PublicFolder
    It may be necessary to run the cmdlet twice, because when there is more than one Public Folder mailbox, it is not possible to delete the primary mailbox before deleting the others.
    Warning: In a Hybrid scenario, where Public Folders are being used On-Premises, the Public Folder mailboxes on Office 365 should be empty and not have any relevant data. If unsure if the Public Folder mailboxes are empty, verify that they are empty before deleting them.
  2. Once all of the Public Folder Mailboxes are deleted from Office 365, change the Organization Configuration to use Public Folders on Office 365, by running on the Exchange Online PowerShell: Set-OrganizationConfig -PublicFoldersEnabled Local -RemotePublicFolderMailboxes $null
    Warning: This will break the connectivity to the On-Premises Public Folders for all users with the mailbox on Office 365. Please plan a maintenance window.
  3. The Public Folder mapping scripts, provided by Support, should run now without any errors.
  4. Once the mapping scripts have run, run the following cmdlet on the Exchange Shell of the Source and the Destination to compare the number of mail Public Folders, and make sure that the numbers match: (Get-PublicFolder -Recurse -ResultSize Unlimited | ? {$_.FolderClass -eq "IPF.Note"}).count
    Note: This may take some time to complete.
  5. Now revert the Organization Configuration, and restore the access to the On-Premises Public Folders by running: Set-OrganizationConfig -PublicFoldersEnabled Remote -RemotePublicFolderMailboxes <YourOnPremisesPFMailbox> This last change can take a while to apply. To make sure that the change applied, run the following cmdlet: Get-Mailbox <username> |fl *public*
    Once you are certain that the default Public Folder mailbox is the one On-Premises, inform the users that the access to the Public Folders has been restored. Again, this might take up to one hour, so plan the Public Folders downtime carefully. Finally, since the Organization Configuration on Office 365 has been changed, make sure that the MigrationWiz administrator on Office 365 has an Office 365 Public Folder mailbox as default.
Was this article helpful?
0 out of 0 found this helpful