How do I get the full parent path of an Exchange public folder in Exchange 2010?
I've run into this a number of times and it's been frustrating. More often than not, I wind up harassing a user who connects to that folder in order to get the full path from them. Once or twice I've just let it go and said "I can't do it without the full path".
But it turns out that get-recipient
does not require the full path in order to return a result.
[PS] > Get-Recipient myPublicFolder
Name RecipientType
---- -------------
myPublicFolder PublicFolder
And get-publicfolder
accepts pipeline input. So you can retrieve the parent path of a public folder (such as "\Parent\Path\myPublicFolder") with the following command:
[PS] > Get-Recipient myPublicFolder | Get-PublicFolder | Format-List ParentPath
ParentPath : \Parent\Path
I have tested and this works whether the public folder is mail-enabled or not. If multiple public folders match your get-recipient results, then this pipeline will return the parent path for all of them.
[PS] > Get-Recipient "marketing"
Name RecipientType
---- -------------
Marketing-1 PublicFolder
Marketing PublicFolder
Marketing-2 PublicFolder
Marketing-3 PublicFolder
[PS] > Get-Recipient "marketing" | Get-Publicfolder | fl Name,ParentPath
Name : Marketing-1
ParentPath : \Parent\Path\Marketing
Name : Marketing
ParentPath : \Parent\Path
Name : Marketing-2
ParentPath : \Parent\Path\Sales
Name : Marketing-3
ParentPath : \Parent\Path\Sales\Reports
I thought I'd share, just in case anyone else runs into the same frustration. This works on Exchange 2010.
This does not work in Exchange 2013 or later. As of this writing (Aug 2019), there does not appear to be any other way to easily retrieve the path of a public folder without filtering the get-publicfolder -recurse
cmdlet.
In PowerShell:
$mailpf = Get-MailPublicFolder "yourEmailHere"
Get-PublicFolder $mailpf.EntryID
It's even more simple if you do this:
Get-MailPublicFolder "PublicFolderName" | Get-PublicFolder
The output will look something like this:
Name Parent Path
---- -----------
PublicFolderName \ParentFolderName