diff --git a/ListmailboxPermissions/run.ps1 b/ListmailboxPermissions/run.ps1 index 847da14a535f..571485b8f123 100644 --- a/ListmailboxPermissions/run.ps1 +++ b/ListmailboxPermissions/run.ps1 @@ -19,8 +19,9 @@ try { $base64IdentityParam = [Convert]::ToBase64String($Bytes) $PermsRequest = New-GraphGetRequest -uri "https://outlook.office365.com/adminapi/beta/$($tenantfilter)/Mailbox('$($Request.Query.UserID)')/MailboxPermission" -Tenantid $tenantfilter -scope ExchangeOnline $PermsRequest2 = New-GraphGetRequest -uri "https://outlook.office365.com/adminapi/beta/$($tenantfilter)/Recipient('$base64IdentityParam')?`$expand=RecipientPermission&isEncoded=true" -Tenantid $tenantfilter -scope ExchangeOnline + $PermRequest3 = New-ExoRequest -Anchor $Request.Query.UserID -tenantid $Tenantfilter -cmdlet "Get-Mailbox" -cmdParams @{Identity = $($Request.Query.UserID); } - $GraphRequest = foreach ($Perm in $PermsRequest, $PermsRequest2.RecipientPermission) { + $GraphRequest = foreach ($Perm in $PermsRequest, $PermsRequest2.RecipientPermission, $PermRequest3) { if ($perm.Trustee) { $perm | Where-Object Trustee | ForEach-Object { [PSCustomObject]@{ @@ -37,6 +38,13 @@ try { } } } + if ($perm.GrantSendonBehalfTo -ne $null) { + $perm.GrantSendonBehalfTo | ForEach-Object { [PSCustomObject]@{ + User = $_ + Permissions = "SendOnBehalf" + } + } + } } $StatusCode = [HttpStatusCode]::OK }