Skip to content

Commit

Permalink
Updated Permissions to show SendOnBehalf
Browse files Browse the repository at this point in the history
Updated Mailbox Permissions to show SendOnBehalf
  • Loading branch information
BNWEIN committed Jul 28, 2023
1 parent f70b96a commit c7c8535
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ListmailboxPermissions/run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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]@{
Expand All @@ -37,6 +38,13 @@ try {
}
}
}
if ($perm.GrantSendonBehalfTo -ne $null) {
$perm.GrantSendonBehalfTo | ForEach-Object { [PSCustomObject]@{
User = $_
Permissions = "SendOnBehalf"
}
}
}
}
$StatusCode = [HttpStatusCode]::OK
}
Expand Down

0 comments on commit c7c8535

Please sign in to comment.