What is this about
In Office 365, recovering a deleted Public Folder Mailbox presents the possibility for a recovered Secondary PF Mailbox to contain Public Folders that may no longer be resident on a newly-created Primary PF Mailbox. Say what? Public Folders reside in one or more Public Folder Mailboxes. The first Public Folder Mailbox is referred to as the “Primary” Public Folder Mailbox. All subsequent Public Folder Mailboxes are referred to as “Secondary” Public Folder Mailboxes. These Secondary PF Mailboxes retrieve Public Folder hierarchy updates from the Primary PF Mailbox. This process is referred to as Public Folder Hierarchy Sync. If you want to read up on related concepts, this might be a good place to start. Public Folder Hierarchy Sync processes and reconciles any Public Folder creation, deletions, and modifications as performed by the users. Once Public Folder Hierarchy Sync completes, if there are any Public Folders on a Secondary mailbox that are not on the Primary, these are considered as “orphaned” Public Folders.Example Scenario
Your friendly Office 365 Tenant Admin creates a Primary Public Folder Mailbox (let’s call it “PrimaryN1”) and a Secondary Public Folder Mailbox (we’ll name this one “SecondaryN1”). Being the wicked smart Admin that s/he is, they decide to host all the content on the Secondary Public Folder Mailbox, and let the Primary Public Folder Mailbox focus solely on mastering the PF hierarchy.
PS C:\pf> New-PublicFolder "Green Monster" -Mailbox SecondaryN1

PS C:\pf> 1..10 | %{New-PublicFolder -Name ("PublicFolder_{0:00}" -f $_) -Mailbox SecondaryN1}


How do you recover a Public Folder Mailbox?
Undo-SoftDeletedMailbox -PublicFolder
In Office 365, when a Public Folder Mailbox is deleted, rather than permanently deleting it right away, PF mailboxes are now “Soft Deleted.” These soft deleted Public Folder mailboxes can be located using Get-Mailbox -PublicFolder -ShowSoftDeletedMailbox:

Great. But how do we find these orphaned folders?
Get-PublicFolder -LostAndFound
In our example, the SecondaryN1 Public Folder Mailbox that was recovered contained 10 Public Folders (PublicFolder_01 – 10). Once Hierarchy Sync executed, it keenly noticed that these were not represented in the PF hierarchy on the Primary. Next, the PF hierarchy reconciliation process (initiated by the Public Folder Mailbox Assistant) created a new Folder on the Primary PF Mailbox under \NON_IPM_SUBTREE\LOST_AND_FOUND, and used the ExchangeGuid of the recovered mailbox as the name (e.g. 25e6e0a3-d601-403a-aca5-9144962ef54b). Finally, PF hierarchy reconciliation moved the formerly orphaned Public Folders (“PublicFolder_01-10”) from the recovered Secondary PF Mailbox to this new folder on the Primary:PS C:\pf> Get-PublicFolder -LostAndFound | ft -a








Fenway Park
\Right Field
\Pesky Pole
PS C:\pf> Get-PublicFolder
Name Parent Path ---- ----------- Fenway Park \ Right Field \Fenway Park Pesky Pole \Fenway Park\Right Field In this disaster recovery example, we have created a new Primary PF Mailbox, and recovered the former PF Mailbox which contained these Public Folders. As we can see with Get-PublicFolder -LostAndFound, here are the previously-orphaned Public Folders, now conveniently placed in the LOST_AND_FOUND Public Folder:PS C:\pf> Get-PublicFolder -LostAndFound | ft -a
Name Parent Path ---- ----------- Fenway Park \NON_IPM_SUBTREE\LOST_AND_FOUND\5773ba6a-9926-4d64-97db-63a2bdd94a5b Pesky Pole \NON_IPM_SUBTREE\LOST_AND_FOUND\5773ba6a-9926-4d64-97db-63a2bdd94a5b Right Field \NON_IPM_SUBTREE\LOST_AND_FOUND\5773ba6a-9926-4d64-97db-63a2bdd94a5b For sake of discussion, we only want to restore "Pesky Pole," so we'll re-create the top-level "Fenway Park," and its subfolder "Right Field."PS C:\pf> New-PublicFolder "Fenway Park"
Name Parent Path
---- -----------
Fenway Park \
PS C:\pf> Get-PublicFolder \NON_IPM_SUBTREE\LOST_AND_FOUND\5773ba6a-9926-4d64-97db-63a2bdd94a5b\"Pesky Pole" | Set-PublicFolder -Path "\Fenway Park\Right Field"
PS C:\pf> Get-PublicFolder “Fenway Park” -Recurse Name Parent Path ---- ----------- Fenway Park \ Right Field \Fenway Park Pesky Pole \Fenway Park\Right Field Play ball!Availability
Undo-SoftDeletedMailbox -PublicFolder is available to Office 365 customers only, as the Soft Deleted Objects functionality does not exist in our On-Premises Exchange Server offerings. Get-PublicFolder -LostAndFound is available to our Office 365 customers.So, to recap…
Undo-SoftDeletedMailbox -PublicFolder allows Office 365 Tenant Administrators to recover deleted Public Folder Mailboxes. Note that if you are Exchange 2013 or Exchange 2016 On-Premises Administrator, you would recover a deleted Public Folder Mailbox using our published guidance. Get-PublicFolder -LostAndFound allows Office 365 Tenant Administrators the ability to locate any Public Folders that would have previously been orphaned (and lost!). Finally, to avoid the need to use this functionality altogether, don’t delete Public Folder Mailboxes unless absolutely necessary. Yet should you need to recover, make sure you recover the Primary PF Mailbox first. Otherwise, recovering any Secondary PF Mailboxes “out of order” (e.g. before recovering the Primary PF Mailbox) will require you to utilize Get-PublicFolders -LostAndFound to locate any missing Public Folders. Scott OseychikUpdated Jul 01, 2019
Version 2.0The_Exchange_Team
Platinum Contributor
Joined April 19, 2019
Exchange Team Blog
You Had Me at EHLO.