Papa Burgundy
Papa Burgundy

Reputation: 6467

Using WIQL, how do you query VSTS Work Items on System.Tags

This is not an on-premise install, just VSTS. I'm new to working with the VSTS REST API and WIQL. I am trying to run a query that filters my work items on System.Tags = 'User Generated'. When I retrieve my Work Item, I can see in the JSON:

System.Tags : "User Generated"

I am using the following guide to build my query and have everything working except when I try to filter on Tags. I have tried [System.Tags] Contains ('User Generated'), etc. Nothing seems to work. Any ideas?

VSTS WIQL Reference

Upvotes: 7

Views: 6883

Answers (1)

Papa Burgundy
Papa Burgundy

Reputation: 6467

Ok so right after I give up and post, I figured it out. I was using Contains incorrectly. I had the filter in parenthesis. Both of the following examples work now.

Select [System.Id], [System.Title], [System.State], [System.Tags]
From WorkItems
Where [State] <> 'Closed'
 AND [State] <> 'Removed'
 AND [Tags] Contains 'User Generated'
 AND [System.WorkItemType] = 'User Story'
 order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc

Or this:

Select [System.Id], [System.Title], [System.State]
From WorkItems
Where [State] <> 'Closed'
 AND [State] <> 'Removed'
 AND [System.Tags] Contains 'User Generated'
 AND [System.WorkItemType] = 'User Story'
 order by [Microsoft.VSTS.Common.Priority] asc, [System.CreatedDate] desc

Upvotes: 7

Related Questions