diff --git a/Modules/CIPPCore/Public/GraphHelper/New-ExoRequest.ps1 b/Modules/CIPPCore/Public/GraphHelper/New-ExoRequest.ps1 index ed2e2b22d3e6..8572b6494df4 100644 --- a/Modules/CIPPCore/Public/GraphHelper/New-ExoRequest.ps1 +++ b/Modules/CIPPCore/Public/GraphHelper/New-ExoRequest.ps1 @@ -142,11 +142,12 @@ function New-ExoRequest { ContentType = 'application/json' } - $Return = Invoke-RestMethod @ExoRequestParams + $Return = Invoke-RestMethod @ExoRequestParams -ResponseHeadersVariable ResponseHeaders $URL = $Return.'@odata.nextLink' $Return } until ($null -eq $URL) + Write-Verbose ($ResponseHeaders | ConvertTo-Json) if ($ReturnedData.'@adminapi.warnings' -and $ReturnedData.value -eq $null) { $ReturnedData.value = $ReturnedData.'@adminapi.warnings' } diff --git a/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 b/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 index 177482688312..6f8379cf0936 100644 --- a/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 +++ b/Modules/CIPPCore/Public/Invoke-CIPPOffboardingJob.ps1 @@ -12,7 +12,7 @@ function Invoke-CIPPOffboardingJob { if ($Options -is [string]) { $Options = $Options | ConvertFrom-Json } - $userid = (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($username)" -tenantid $Tenantfilter).id + $userid = (New-GraphGetRequest -uri "https://graph.microsoft.com/beta/users/$($username)?`$select=id" -tenantid $Tenantfilter).id Write-Host "Running offboarding job for $username with options: $($Options | ConvertTo-Json -Depth 10)" $Return = switch ($Options) { { $_.'ConvertToShared' -eq 'true' } { diff --git a/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 b/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 index 106256602dee..31c400a79d5c 100644 --- a/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 +++ b/Modules/CIPPCore/Public/Remove-CIPPMailboxPermissions.ps1 @@ -36,7 +36,19 @@ function Remove-CIPPMailboxPermissions { } } 'FullAccess' { - $permissions = New-ExoRequest -tenantid $TenantFilter -cmdlet 'Remove-MailboxPermission' -cmdParams @{Identity = $userid; user = $AccessUser; accessRights = @('FullAccess') } -Anchor $userid + $ExoRequest = @{ + tenantid = $TenantFilter + cmdlet = 'Remove-MailboxPermission' + cmdParams = @{ + Identity = $userid + user = $AccessUser + accessRights = @('FullAccess') + Verbose = $true + } + Anchor = $userid + } + New-ExoRequest @ExoRequest + if ($permissions -notlike "*because the ACE doesn't exist on the object.*") { Write-LogMessage -user $ExecutingUser -API $APIName -message "Removed FullAccess permissions for $($AccessUser) from $($userid)'s mailbox." -Sev 'Info' -tenant $TenantFilter "Removed FullAccess permissions for $($AccessUser) from $($userid)'s mailbox."