“Public Folders” – Did anybody just cringe when you read that? Well yes I agree as PF’s have been long the thorn in the Exchange Admins side. But they do have their usages and some users would tell you that their life depended on them, literally. When we get to the point of migration of these little nasties up to Office 365 well there are some trick involved.

Now, when I say “Modern” in the title here, then this is referring to Exchange 2013 and 2016. The earlier versions on Exchange 2007, 2010 are referred to as “Legacy”. Therefore if you need the “Legacy” version instead, these instructions are in a separate article under Public Folders so check that out.

Generally when we start an Office 365 migration we are not immediately thinking about Public Folders. This article will show you how to map the users that are migrated to Office 365 back to the On Premises version so they can continue to work as usual. Remember that Public Folders cannot co-exist on both systems, they will need to be in just one place or the other. The easiest way is to map the users back to the On Premises servers and deal with the migration of them later on.

For the full Microsoft version of what we are about to do then you can refer to this site.

https://docs.microsoft.com/en-us/exchange/collaboration-exo/public-folders/set-up-modern-hybrid-public-folders

What I am trying to do here instead is to provide a quick and simple walk through of the commands you actually need to run to get it going quickly and simply. If you don’t want all the fluff, then read on.

1. Download the Mail Enabled Public Folder Scripts from the Microsoft site and save them in C:\Scripts on your Exchange Server.

https://www.microsoft.com/download/details.aspx?id=46381

2. Because the Directory Sync mechanism doesn’t sync mail enabled public folders, that’s what these scripts are for. Run them on your Exchange Server like this.

Sync-MailPublicFolders.ps1 -Credential (Get-Credential) -CsvSummaryFile “<sync_summary.csv>”

3. On Exchange Online configure the Office 365 system to talk back through the hybrid server with this command.

Set-OrganizationConfig -PublicFoldersEnabled Remote -RemotePublicFolderMailboxes PFMailbox1,PFMailbox2,PFMailbox3

The references above for PFMailbox1 etc relate to the Public Folder Mailbox entries that you can find in the EAC on your On Premises Exchange servers. Put in all of the databases that you can find and it will map them through.

I do want to mention a small trap that is easy to fall into. It is possible to get the following error when you run the command above.

Looks pretty serious but is actually really simple. The problem is that the PFMailbox1 object in Active Directory lives in the “Users” OU. There is a real good chance that you may not be syncing that OU and therefore it can’t find it. So either move the object out, or sync “Users” and all will be well once it takes effect in Azure. Yes I spent a few hours working that little nugget out a while back, so you’re welcome!

And that is about it. In my experience it takes about an hour for the users in the Cloud to start seeing the Public Folders On Premises so don’t freak out when it is not immediately available. Just give it time and it will work out.