Skip to main content

Add-VSTeamWorkItem

SYNOPSIS

Adds a work item to your project.

SYNTAX

Add-VSTeamWorkItem -Title <String> [-Description <String>] [-IterationPath <String>] [-AssignedTo <String>]
[-ParentId <Int32>] [-AdditionalFields <Hashtable>] [-ProjectName <String>] -WorkItemType <String>
[<CommonParameters>]

DESCRIPTION

Add-VSTeamWorkItem will add a new work item to your project.

EXAMPLES

Example 1

Set-VSTeamDefaultProject Demo
Add-VSTeamWorkItem -Title "New Work Item" -WorkItemType Task

ID Title Status
-- ---
id: Add-VSTeamWorkItem
title: Add-VSTeamWorkItem
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamWorkItem.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
id: Add-VSTeamWorkItem
title: Add-VSTeamWorkItem
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamWorkItem.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
----- ---
id: Add-VSTeamWorkItem
title: Add-VSTeamWorkItem
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamWorkItem.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
---
6 New Work Item To Do

Example 3

Set-VSTeamDefaultProject Demo
$additionalFields = @{"System.Tags"= "TestTag"; "System.AreaPath" = "Project\\MyPath"}
Add-VSTeamWorkItem -Title "New Work Item" -WorkItemType Task -Description "This is a description" -AdditionalFields $additionalFields

ID Title Status
-- ---
id: Add-VSTeamWorkItem
title: Add-VSTeamWorkItem
hide_title: true
hide_table_of_contents: false
custom_edit_url: https://github.com/MethodsAndPractices/vsteam/edit/trunk/.docs/Add-VSTeamWorkItem.md
description: ''
keywords:
- vsteam
- cmdlet
- azure devops
------
6 New Work Item To Do

PARAMETERS

-Title

The title of the work item

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Description

The Description of the work item

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-IterationPath

The IterationPath of the work item

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AssignedTo

The email address of the user this work item will be assigned to.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-WorkItemType

The type of work item to add.

You can tab complete from a list of available work item types.

You must use Set-VSTeamDefaultProject to set a default project to enable the tab completion.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ParentId

The Id of the parent work item that this work item will be related to.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-AdditionalFields

Hashtable which contains a key value pair of any field that should be filled with values. Key is the internal name of the field and the value is the content of the field being filled. E.g. the internal name for the area path is 'System.AreaPath'.

Type: Hashtable
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProjectName

Specifies the team project for which this function operates.

You can tab complete from a list of available projects.

You can use Set-VSTeamDefaultProject to set a default project so you do not have to pass the ProjectName with each call.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String

ProjectName

WorkItemType

OUTPUTS

NOTES

WorkItemType is a dynamic parameter and uses the project value to query their validate set.

If you do not set the default project by calling Set-VSTeamDefaultProject before calling Add-VSTeamWorkItem you need to provide the -ProjectName before -WorkItemType or will have to type in the names.

Any of the basic work item parameters defined in this method, will cause an exception if also added to the parameter AdditionalFields, since it is redundant. Either only use the parameter or define them in the AdditionalFields parameter.

Prerequisites:

Set the account and version that all calls will use with Set-VSTeamAccount. Default version sets to API version 3.0 (TFS2017) if not manually set.

tips:

  • check called version of the API with Get-VSTeamAPIVersion or Get-VSTeamInfo
  • use Set-VSTeamDefaultProject to set default project for every call
  • use Set-VSTeamDefaultAPITimeout to change the default timeout of 60 seconds for all calls.
  • use Profiles to load an account and the correct version