Skip to content

Get-EXOMailboxFolderPermission

Exchange Online Management: Gets folder-level permissions in mailboxes

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [Parameter(Mandatory = $true)]
    [string]$Identity,
    [Parameter(Mandatory = $true)]
    [string]$FolderName,
    [switch]$GroupMailbox,
    [string]$User
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'Identity' = "$($Identity):\$($FolderName)"; 'GroupMailbox' = $GroupMailbox}

        if ($PSBoundParameters.ContainsKey('User')) {
            $cmdArgs.Add('User', $User)
        }

        $result = Get-EXOMailboxFolderPermission @cmdArgs | Select-Object *
        if ($null -eq $result -or $result.Count -eq 0) {
            Write-Output "No folder permissions found"
            return
        }
        foreach ($item in $result) {
            $item | Add-Member -NotePropertyName Timestamp -NotePropertyValue (Get-Date -Format "yyyy-MM-dd HH:mm:ss") -PassThru -Force
        }
    }
    catch { throw }
}

Name, Alias or SamAccountName of the mailbox

The mailbox folder to view permissions for

Off

Required to return Microsoft 365 Groups in the results

Filters results by the user granted permission to the mailbox folder (Name, Alias or Guid)

An interactive directory of PowerShell scripts.