Skip to main content

Get-VSTeamWiql

SYNOPSIS

Returns work items from the given WIQL query or a saved query by ID from your projects team.

SYNTAX

ByID (Default)

Get-VSTeamWiql -Id <String> [-Team <String>] [-ProjectName <Object>] [-Top <Int32>] [-TimePrecision] [-Expand]
[<CommonParameters>]

ByQuery

Get-VSTeamWiql -Query <String> [-Team <String>] [-ProjectName <Object>] [-Top <Int32>] [-TimePrecision]
[-Expand] [<CommonParameters>]

DESCRIPTION

Returns work items from the given WIQL query or a saved query by ID from your projects team.

EXAMPLES

Example 1

Get-VSTeamWiql -Query "Select [System.Id], [System.Title], [System.State] From WorkItems" -Team "MyProject Team" -Project "MyProject" -Expand

This command gets work items via a WIQL query and expands the return work items with only the selected fields System.Id, System.Title and System.State.

Example 2

Get-VSTeamWiql -Query "Select [System.Id], [System.Title], [System.State] From WorkItems" -Team "MyProject Team" -Project "MyProject"

This command gets work items via a WIQL query and returns the WIQL query result with only work item IDs.

PARAMETERS

-Id

The id query to return work items for. This is the ID of any saved query within a team in a project

Type: String
Parameter Sets: ByID
Aliases:

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

-Query

The WIQL query. For the syntax check the official documentation (https://docs.microsoft.com/en-us/azure/devops/boards/queries/wiql-syntax?view=azure-devops).

Type: String
Parameter Sets: ByQuery
Aliases:

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

-Team

Team ID or team name.

Type: String
Parameter Sets: (All)
Aliases:

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

-Top

The max number of results to return.

Type: Int32
Parameter Sets: (All)
Aliases:

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

-TimePrecision

Whether or not to use time precision.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Expand

The expand the work items with the selected attributes in the WIQL query.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
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: Object
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
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

OUTPUTS

NOTES

If you do not set the default project by called Set-VSTeamDefaultProject you must pass in -ProjectName for the tab completion of names to work.

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