Introducing Public Folder “Lost and Found” functionality
Published Oct 09 2015 08:23 AM 31K Views

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. image Next, when they initially created these Public Folders, they specified the target Public Folder Mailbox for this PF. For example:

PS C:\pf> New-PublicFolder "Green Monster" -Mailbox SecondaryN1

image In the example below, 10 Public Folders are being created on the SecondaryN1 Public Folder Mailbox:

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

image Things are going smooth for some time, until they hire a new Admin (we’ll call him “Chuckie Sullivan”) who for whatever reason, decided to delete both of their Public Folder Mailboxes. Taking it a step further, he created a new Primary and named it “PrimaryN2.” image Once he realized the error of his ways, Chuckie recovered the former Secondary Public Folder Mailbox (SecondaryN1) to get the content back.

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: image In Office 365, these Public Folder Mailboxes are now available for recovery using Undo-SoftDeletedMailbox -PublicFolder: image W00t! Now we have a Primary PF Mailbox (PrimaryN2), but it has no clue about all that glorious data that was recovered via Undo-SoftDeletedMailbox -PublicFolder. When Public Folder Hierarchy sync finds Public Folders that don’t exist on the Primary, it re-creates them under a special folder called “LOST_AND_FOUND.” This resides at the root of the NON_IPM_SUBTREE, so it is not shown to end users via Outlook Web App or Outlook.

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

image For more information on the mechanics of Public Folder Hierarchy Sync, I encourage you to check out “The Latest on Modern Public Folders” as presented at Microsoft Ignite 2015 by Ladislau Conceicao, Brian Day, and Kanika Ramji. In the meantime, this simplified attempt at illustrating these concepts may help this scenario to be easier to understand. image image image image image There is a new property called LostAndFoundFolderOriginalPath that is added to each Public Folder to keep track of where the folder originated in the Public Folder hierarchy. Let’s say we wanted to find out where PublicFolder_02 originally lived: image This shows us that PublicFolder_02 originally lived at the root of the Public Folder hierarchy. Now we can run Get-PublicFolder and Set-PublicFolder against these Public Folders like we normally would. For example, here is how to retrieve a Public Folder out of LOST_AND_FOUND and back into the regular Public Folder hierarchy for end users to use again: image Awwyeah! We have successfully rescued PublicFolder_02 from what would have previously been certain death for that Public Folder. Here’s another example illustrating that the same steps are applicable for Subfolders of parent Public Folders. We have three Public Folders: "Fenway Park," "Right Field," and "Pesky Pole." The Public Folder hierarchy is illustrated below:

Fenway Park
\Right Field
\Pesky Pole

As seen from Powershell:

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> New-PublicFolder "Right Field" -Path "\Fenway Park" Name           Parent Path ----           ----------- Right Field           \Fenway Park Now let's put "Pesky Pole" back where it belongs: in Right Field.

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!


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 Oseychik
Version history
Last update:
‎Jul 01 2019 04:24 PM
Updated by: