Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Functions/AzureDevOps/Remove-ADOWorkItem.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
.Example
Remove-ADOWorkItem -Organization StartAutomating -Project PSDevOps -ID 10
.Example
Remove-ADOWorkItem -Organization StartAutomating -Project PSDevOps -Query "Select [System.ID] from WorkItems Where [System.Title] = 'Test-WorkItem'" -PersonalAccessToken $pat -Confirm:$false
Remove-ADOWorkItem -Organization StartAutomating -Project PSDevOps -Query "Select [System.ID] from WorkItems Where [System.Title] = 'Test-WorkItem'" -PersonalAccessToken $pat -Confirm:$false -Destroy
.Link
Invoke-ADORestAPI
.Link
Expand Down Expand Up @@ -54,7 +54,11 @@
# If targeting TFS, this will need to change to match your server version.
# See: https://docs.microsoft.com/en-us/azure/devops/integrate/concepts/rest-api-versioning?view=azure-devops
[string]
$ApiVersion = "5.1")
$ApiVersion = "5.1",

# If set, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone.
[switch]
$Destroy)

dynamicParam { . $GetInvokeParameters -DynamicParameter }
begin {
Expand All @@ -81,6 +85,10 @@
if ($ApiVersion) {
"api-version=$ApiVersion"
}
$uri +=
if ($Destroy) {
"&destroy=true"
}

$invokeParams.Uri = $uri
$invokeParams.Method = 'DELETE'
Expand Down
25 changes: 21 additions & 4 deletions docs/Remove-ADOWorkItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Remove-ADOWorkItem -Organization StartAutomating -Project PSDevOps -ID 10

#### EXAMPLE 2
```PowerShell
Remove-ADOWorkItem -Organization StartAutomating -Project PSDevOps -Query "Select [System.ID] from WorkItems Where [System.Title] = 'Test-WorkItem'" -PersonalAccessToken $pat -Confirm:$false
Remove-ADOWorkItem -Organization StartAutomating -Project PSDevOps -Query "Select [System.ID] from WorkItems Where [System.Title] = 'Test-WorkItem'" -PersonalAccessToken $pat -Confirm:$false -Destroy
```

---
Expand Down Expand Up @@ -153,6 +153,23 @@ See: https://docs.microsoft.com/en-us/azure/devops/integrate/concepts/rest-api-v



---
#### **Destroy**

If set, the work item is deleted permanently. Please note: the destroy action is PERMANENT and cannot be undone.



> **Type**: ```[SwitchParameter]```

> **Required**: false

> **Position**: named

> **PipelineInput**:false



---
#### **WhatIf**
-WhatIf is an automatic variable that is created when a command has ```[CmdletBinding(SupportsShouldProcess)]```.
Expand All @@ -179,12 +196,12 @@ If the command sets a ```[ConfirmImpact("Medium")]``` which is lower than ```$co
---
### Syntax
```PowerShell
Remove-ADOWorkItem -Organization <String> -Project <String> -ID <String> [-Server <Uri>] [-ApiVersion <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-ADOWorkItem -Organization <String> -Project <String> -ID <String> [-Server <Uri>] [-ApiVersion <String>] [-Destroy] [-WhatIf] [-Confirm] [<CommonParameters>]
```
```PowerShell
Remove-ADOWorkItem -Organization <String> -Project <String> -Query <String> [-Server <Uri>] [-ApiVersion <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-ADOWorkItem -Organization <String> -Project <String> -Query <String> [-Server <Uri>] [-ApiVersion <String>] [-Destroy] [-WhatIf] [-Confirm] [<CommonParameters>]
```
```PowerShell
Remove-ADOWorkItem -Organization <String> -Project <String> -QueryID <String> [-Server <Uri>] [-ApiVersion <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Remove-ADOWorkItem -Organization <String> -Project <String> -QueryID <String> [-Server <Uri>] [-ApiVersion <String>] [-Destroy] [-WhatIf] [-Confirm] [<CommonParameters>]
```
---