Skip to content

Get-EXORecipientPermission

Exchange Online Management: Gets SendAs permissions configured for users

#Requires -Version 5.1

[CmdletBinding()]
Param(
    [string]$Identity,
    [string]$Trustee,
    [int]$ResultSize = 1000
)

Process {
    try {
        [hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'; 'ResultSize' = $ResultSize}

        if (-not [System.String]::IsNullOrWhiteSpace($Identity)) {
            $cmdArgs.Add('Identity', $Identity)
        }
        if ($PSBoundParameters.ContainsKey('Trustee')) {
            $cmdArgs.Add('Trustee', $Trustee)
        }

        $result = Get-EXORecipientPermission @cmdArgs
        if ($null -eq $result -or $result.Count -eq 0) {
            Write-Output "No recipient 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 target recipient

Filters results by the user or group to whom the permission is granted

Maximum number of results to return

An interactive directory of PowerShell scripts.