Azure DevOps Work Item Query Operators

Dave Lloyd
ObjectSharp (a Centrilogic Company)
3 min readJul 29, 2019

I recently wrote a short article on Work item Query Macros. Since I am such a fan of the work item query engine, I thought I would write another one. This time about some of the operators available that people don’t often notice or sometimes they just don’t fully understand how they work.

I’ll do one of my favorites first.

Was Ever

The Was Ever operator will match the value in the clause at any previous point in the history of the work item. If you want to know all the user Stories that were ever assigned to you regardless of who they are assigned to now, try this. Works with String and DateTime fields

Assigned To		Was Ever	@Me 

[Field]

I’m not going to talk about the basic operators like = < > etc. we all know how they work, however have you ever noticed these =[Field] <>[Field]. When you see the [Field] it means you can compare the value of one field to the value of another.

For example let’s say you want to see all the Bugs that were closed by the same person that created them.

Work Item Type		= 		Bug
Created By =[Field] Closed By

Text Searches

The difference between Contains and Contains Words is subtle. Think of it like this. Contains works on any string field, therefore you will see contains as an operator when you select Severity and Assigned To, but also Description and Title. You will only see Contains Words on specific fields like Description, Title and History. Essentially, Long-text fields that are indexed for full-text search.

Contains, Does Not Contain

Search for an exact or partial word or phrase in the field you have selected.

Contains Words and Does Not Contain Words

Search for the exact text string or words within the field you have selected. You can use a wildcard, * to enter partial words or phrases.

Title		Contains		Login
Description Contains Words Login

Lists

The In and Not In operators allow you to compare to multiple values including Numbers, Strings, DateTime or TreePath. For example if you want to find all the User Stories and bugs where the Board Column is Development, QA or Deployment. Instead of building a query with multiple clauses you can do this.

Work Item Type		In	User Story, Bug
Board Column In Development, QA, Deployment

Of course Not in is the opposite.

Work item State		In	User Story, Bug
Board Column Not In Development, QA, Deployment

Is Empty and Is Not Empty

These operators do not require a value, and are meant for use with HTML fields.

Description	Is EmptyDescription	Is Not Empty

Under and Not Under

These are likely very well known but still worth a mention. Are Path and Iteration Path are TreePath type fields. Meaning they can have a large number of values under each node in the path.

For example we use path to designate teams lets assume for example I have three teams in my Parts Unlimited team project one in Toronto one in London and an External Vendor. Each team may divide their work into more sub paths, to differentiate the type of Story or task it is.

Parts Unlimited\Toronto\UI
Parts Unlimited\Toronto\DB
Parts Unlimited\Toronto\Backend
Parts Unlimited\London\AzureFunctions
Parts Unlimited\London\InfrastructureAsCode
Parts Unlimited\External\SOW1
Parts Unlimited\External\SOW2

When querying for tasks assigned to the Toronto team I can specifically look for UI tasks like this. Which will only return Tasks with that specific area path.

Work Item Type		=	Task
Area path = Parts Unlimited\Toronto\UI

However if I wanted to query for all the tasks assigned to the Toronto team I would do this.

Work Item Type		=	Task
Area Path under Parts Unlimited\Toronto

If I wanted to find all the tasks assigned to Toronto and London leaving out the External Vendor I could do this.

Work Item Type		Not Under	Parts Unlimited\External

--

--

Dave Lloyd
ObjectSharp (a Centrilogic Company)

I have been writing software and teaching/coaching developers for 40 years. I love sharing knowledge and experience.