Exporting Exchange Public Folders to PST Files

Public Folders in Exchange allow you to store shared user data on Exchange servers in a hierarchical view. In Exchange Server 2013 and all newer versions (Exchange 2016, 2019), Public Folders are stored in mailboxes. A public folder is a special type of Exchange mailbox that can store both the public folder hierarchy and the content. This allows providing the high availability of Public Folders by placing the mailbox in a database that is a part of the Database Availability Group (DAG).

Users can access Public Folders from Microsoft Outlook (2013+), Outlook Web Access (OWA), and Outlook for Mac.

You can list Public Folders in your Exchange organization in the Exchange Admin Center (EAC) or using PowerShell:

Get-PublicFolder -Recurse -ResultSize Unlimited

export public folder to pst

The list of folders in a specific Public Folder can be displayed as follows:

Get-PublicFolder -Identity "HelpDesk" -Recurse -ResultSize Unlimited

You can view a list of the permissions assigned to users for a specific Public Folder:

Get-PublicFolderClientPermission -Identity "HelpDesk" | Select User, AccessRights

export public folder to pst powershell

There are no built-in tools to export the content of Public Folders to PST files in the Exchange Server. Unfortunately, the PowerShell New-MailboxExportRequest cmdlet doesn’t support exporting Public Folder content to PST.

The most popular and easiest way to export the contents of a Public Folder to a PST file is the Import/ Export feature built into Outlook. Let’s take a look at how to export the Public Folder content to the PST file using Outlook.

Note. To export the contents of a public folder to a PST file, you must have Microsoft Outlook (version 2013 or newer) installed on your computer with Exchange profile configured, and the required public folders must be connected in Outlook’s configuration.

powershell export public folder to pst

Run the Outlook and select File > Open > Import/Export.

exchange export public folder to pst

In the window that opens, select “Export to a file” > “Next”.

exchange 2016 export public folder to pst powershell

Select “Outlook Data file (.PST)” on the next wizard step and click “Next”.

public folder export to pst powershell

Select the Public Folders whose content you want to export. Check the “Include subfolder” option.

export public folder to pst powershell exchange 2016

Specify the name of the PST file to which you want to upload the contents of the Public Folder and check “Replace duplicates with items exported”. Click Finish and wait for Outlook to export.

public folder export to pst on powershell

Exporting Public Folder content to PST via Outlook can take quite a long time.

If the size of the Public Folder is more than 10–20 GB, Outlook can easily crash during exporting. In this case, it is better to export the contents of the Public Folder by parts.

You can use the following PowerShell script to export Public Folder to PST. This script uses the Outlook.Application COM object to access the Public Folder, so Outlook must be installed and configured on your computer:

function Export-MailboxFolder($folder)

 {

    Begin{

        $Outlook = New-Object -ComObject Outlook.Application

        $namespace = $Outlook.GetNameSpace("MAPI")

    }

    Process{

        New-Item -Path 'D:\Backup\PublicFolder' -Name "$($folder.Name)" -ItemType Directory    

        foreach ($f in $folder.folders) {

        $PSTPath = 'D:\Backup\PublicFolder' + '\' + "$($folder.Name)"

        $PSTName = $($f.name) + '.pst'

        $FullPST = $PSTPath + '\' + $PSTName

        $namespace.AddStore("$FullPST")

        $pstFolder = $namespace.Session.Folders.GetLast()

        [void]$f.CopyTo($pstFolder)

        }

    }

    End{

        "Remove attached PST in Outlook"

        $RemPST = $Outlook.Session.Stores | Where DisplayName -EQ 'Outlook Data File'

        foreach ($pst in $RemPST){

        $Outlook.Session.RemoveStore($pst.GetRootFolder())

        }

    }

}

$PublicFolderToExport = $Outlook.Session.Folders.Item('Public Folders - Helpdesk').folders.item('All Public Folders').Folders.Item('Level-1').folders.item('Level-2').folders.item('Level-3')

Export-MailboxFolder $PublicFolderToExport

export public folder calendar to pst

I enjoy technology and developing websites. Since 2012 I'm running a few of my own websites, and share useful content on gadgets, PC administration and website promotion.
Cyril Kardashevsky

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.