Skip to content

Commit

Permalink
Fix for Issue 109 deleting pending users (#115)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Hoggins <[email protected]>
  • Loading branch information
andrew-hoggins and Andrew Hoggins authored May 6, 2024
1 parent baa9ea4 commit aad13c6
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions PSZoom/Public/Users/Remove-ZoomUser.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -88,33 +88,39 @@ function Remove-ZoomUser {
foreach ($user in $UserId) {
$request = [System.UriBuilder]"https://api.$ZoomURI/v2/users/$user"
$query = [System.Web.HttpUtility]::ParseQueryString([String]::Empty)
$query.Add('action', $Action)
$ZoomUserToBeDeletedInfo = get-zoomuser -UserId $user -ErrorAction Stop

if ($ZoomUserToBeDeletedInfo.status -ne "pending") {

$query.Add('action', $Action)

if ($PSBoundParameters.ContainsKey('EncryptedEmail')) {
$query.Add('encrypted_email', $EncryptedEmail)
}
if ($PSBoundParameters.ContainsKey('EncryptedEmail')) {
$query.Add('encrypted_email', $EncryptedEmail)
}

if ($PSBoundParameters.ContainsKey('TransferEmail')) {
$query.Add('transfer_email', $TransferEmail)
}
if ($PSBoundParameters.ContainsKey('TransferEmail')) {
$query.Add('transfer_email', $TransferEmail)
}

if ($PSBoundParameters.ContainsKey('TransferMeeting')) {
$query.Add('transfer_meeting', $TransferMeeting)
}
if ($PSBoundParameters.ContainsKey('TransferMeeting')) {
$query.Add('transfer_meeting', $TransferMeeting)
}

if ($PSBoundParameters.ContainsKey('TransferWebinar')) {
$query.Add('transfer_webinar', $TransferWebinar)
}
if ($PSBoundParameters.ContainsKey('TransferWebinar')) {
$query.Add('transfer_webinar', $TransferWebinar)
}

if ($PSBoundParameters.ContainsKey('TransferRecording')) {
$query.Add('transfer_recording', $TransferRecording)
}
if ($PSBoundParameters.ContainsKey('TransferRecording')) {
$query.Add('transfer_recording', $TransferRecording)
}

if ($PSBoundParameters.ContainsKey('TransferWhiteboard')) {
$query.Add('transfer_whiteboard', $Transferwhiteboard)
if ($PSBoundParameters.ContainsKey('TransferWhiteboard')) {
$query.Add('transfer_whiteboard', $Transferwhiteboard)
}

$request.Query = $query.ToString().ToLower()
}

$request.Query = $query.ToString().ToLower()


if ($PScmdlet.ShouldProcess($user, 'Remove')) {
$response = Invoke-ZoomRestMethod -Uri $request.Uri -Method DELETE
Expand Down

0 comments on commit aad13c6

Please sign in to comment.