Functions/Remove-IAWidget.ps1
Function Remove-IAWidget { [CmdletBinding()] Param( [Parameter(Mandatory = $true, ParameterSetName = 'IAWidget', ValueFromPipeline = $true)] [PSObject] $IAWidget, [Parameter(Mandatory = $true, ParameterSetName = 'Id', ValueFromPipelineByPropertyName = $true)] [Guid] $Id ) Process { if($IAWidget){ foreach($widget in $IAWidget){ $Uri = "Widgets($($IAWidget.Id))" $response = Invoke-IAQuery -QueryUrl $Uri -Method Delete if ($null -eq $response.value) { return $null } return $response.value } } if($Id){ foreach($item in $Id){ $Uri = "Widgets($item)" $response = Invoke-IAQuery -QueryUrl $Uri -Method Delete if ($null -eq $response.value) { return $null } return $response.value } } } } |