You can get a list of all public folders with the Exchange powershell cmdlet Get-PublicFolder and you can easily extract the permissions applied to the public folder by using the Get-PublicFolderClientPermission cmdlet.
Before proceed run the below commands to connect Exchange Online (EXO) powershell.
$365Logon = Get-Credential $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $365Logon -Authentication Basic -AllowRedirection Import-PSSession $Session
Run the below command to list all the public folders in your organization.
Get-PublicFolder -Recurse -ResultSize Unlimited
The below command returns the specific folder “Support” and all the sub-folders located under this folder.
Get-PublicFolder -Identity "Support" -Recurse -ResultSize Unlimited
The below command list only first level sub-folders alone.
Get-PublicFolder -Identity "Support" -GetChildren -ResultSize Unlimited
Run the below command to list the applied permissions in a public folder.
Get-PublicFolderClientPermission -Identity "Support" | Select User, AccessRights
The below command returns all the folders and the permissions applied to each folder.
Get-PublicFolder -Recurse | Get-PublicFolderClientPermission | Select Identity, User, AccessRights
Export all Public Folder Permissions
The below commands fetch all folders and permissions applied to the folders and export the result to CSV file.
$Result=@() $allFolders = Get-PublicFolder -Recurse -ResultSize Unlimited $totalfolders = $allFolders.Count $i = 1 $allFolders | ForEach-Object { $folder = $_ Write-Progress -activity "Processing $folder" -status "$i out of $totalfolders completed" $folderPerms = Get-PublicFolderClientPermission -Identity $folder.Identity $folderPerms | ForEach-Object { $Result += New-Object PSObject -property @{ Folder = $folder.Identity User = $_.User Permissions = $_.AccessRights }} $i++ } $Result | Select Folder, User, Permissions | Export-CSV "C:\PublicFolderPermissions.CSV" -NoTypeInformation -Encoding UTF8