Skip to content

Commit

Permalink
Merge pull request KelvinTegelaar#510 from kris6673/Remove-ex-connector
Browse files Browse the repository at this point in the history
Fix being unable to remove Exchange connectors
  • Loading branch information
KelvinTegelaar authored Dec 8, 2023
2 parents 43adf44 + 9b52598 commit 8da70e0
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions Modules/CIPPCore/Public/Invoke-RemoveExConnector.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,15 @@ Function Invoke-RemoveExConnector {
$APIName = $TriggerMetadata.FunctionName
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -message 'Accessed this API' -Sev 'Debug'
$Tenantfilter = $request.Query.tenantfilter


$Params = @{
Identity = $request.query.guid
}


try {

$Params = @{ Identity = $request.query.GUID }

$GraphRequest = New-ExoRequest -tenantid $Tenantfilter -cmdlet "Remove-$($Request.query.Type)Connector" -cmdParams $params
$GraphRequest = New-ExoRequest -tenantid $Tenantfilter -cmdlet "Remove-$($Request.query.Type)Connector" -cmdParams $params -useSystemMailbox $true
$Result = "Deleted $($Request.query.guid)"
Write-LogMessage -API 'TransportRules' -tenant $tenantfilter -message "Deleted transport rule $($Request.query.guid)" -sev Debug
} catch {
}
catch {
$ErrorMessage = Get-NormalizedError -Message $_.Exception
$Result = $ErrorMessage
}
Expand Down

0 comments on commit 8da70e0

Please sign in to comment.