Query quick reference

Azure Boards | Azure DevOps Server 2019 | TFS 2018 | TFS 2017 | TFS 2015 | TFS 2013

Use this index to quickly access information on query editor tasks, operators available based on data type, and access sample queries.

Query tasks

Operators and macros supported for each data type

The following table indicates the operators and macros available for the different field data types. Each field is associated with a data type. You can find the data type listed in the descriptions of each field, which you can look up using the Work item field index. Operators available for defining a query clause depends on the data type of the field that you select. For more detailed descriptions of data types, operators, and macros, see Query fields, operators, and macros.

Data type

Description

Supported operators and macros

Boolean 1

Supports a True/False value. Query samples: Query by assignment or workflow changes.

= , <> , =[Field] , <>[Field]

DateTime

A date field in which you can specify a variable, such as @Today or @Today-1, or a value, such as 1/1/2012. Enter dates in the Date Pattern you set for your personal profile. (See Set personal preferences for details.)

For query examples, see Query by date or@CurrentIteration.

= , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], In, Not In, Was Ever

Macros: @Today, valid with any DateTime field

Additional macros supported on Azure DevOps 2019 Update 1 and later versions::
@StartOfDay, @StartOfWeek, @StartOfMonth, and @StartOfYear, valid with any DateTime field

Double Also referred to as Decimal and includes picklistDouble2. A real number, such as 0.2 or 3.5.

Query samples: Query by numeric fields.

= , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], In, Not In, Was Ever
GUID

A character string that represents a unique ID. = , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], In, Not In, Was Ever

History

Custom formatted field used to track historical information and only assigned to the History field.

Query samples: History and auditing.

Contains Words, Does Not Contain Words

HTML

Text strings that support formatted descriptions, such as the Description or Repro Steps fields. These fields are automatically indexed for full-text search when full-text search is available. Query samples: Query by titles, IDs, and rich-text fields.

Contains Words, Does Not Contain Words, Is Empty3, Is Not Empty3
Identity A String field that is used to hold a user identity.

Query samples: Query by assignment or workflow changes.

= , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], Contains, Does Not Contain, In, Not In, In Group, Not In Group, Was Ever

Macros: @me valid for all Identity fields

Integer Also includes picklistInteger2. A 32-bit integer that is signed, such as 0, 1, 2, 34.

Query samples: Query by numeric fields

= , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], In, Not In, Was Ever

Macros: @Follows4, @MyRecentActivity5, @RecentMentions5, @RecentProjectActivity6, valid when used with the ID field

PlainText Multi-line text strings that support long descriptions and are automatically indexed for full-text search, when full-text search is available.

Query samples: Query by titles, IDs, and rich-text fields.

Contains Words, Does Not Contain Words, Is Empty3, Is Not Empty3
String Also includes picklistString2. Short single-line text that can contain up to 255 Unicode characters. String fields support the Title field, picklists (drop-down menus), user account ids, Tags, and other fields.

Query samples: Query by titles, IDs, and rich-text fields and Query by picklist value.

= , <> , > , < , >= , <= , =[Field], <>[Field], >[Field], <[Field], >=[Field], <=[Field], Contains, Does Not Contain, In, Not In, In Group, Not In Group, Was Ever

Macros: [Any], valid with the Work Item Type field
@Project7, valid with the Team Project field

TreePath

Field type that supports the Area Path and Iteration Path fields. You define the tree structure for a project—area paths and iteration paths.

Query samples: Query by area or iteration path and Query by date or current iteration.

Under, Not Under

Macros: @TeamAreas8, valid with Area Path field
@CurrentIteration9 and@CurrentIteration +/- n10 valid with the Iteration Path field

Notes:

  1. The Boolean data type field is supported for TFS 2017 and later versions.
  2. The picklist... data types are only assigned to custom fields defined for an inherited process. The Inherited process model is only supported for Azure DevOps Services and Azure DevOps Server 2019.
  3. The Is Empty and Is Not Empty operators are supported for Azure DevOps Server 2019 RC2 and later versions.
  4. The @Follows macro is supported for TFS 2017 and later versions.
  5. The @MyRecentActivity, @RecentMentions, @RecentProjectActivity macros are supported for Azure Boards and TFS 2018.2 and later versions.
  6. The @RecentProjectActivity macro is supported for Azure Boards only at this time.
  7. The @Project macro is supported for TFS 2015.1 and later versions. The system automatically defaults to filtering based on the current project. To learn more, see Query across projects.
  8. The @TeamAreas macro is supported for Azure Boards and Azure DevOps Server 2019 and later versions.
  9. The @CurrentIteration macro is supported for TFS 2015 and later versions, and only when run from the web portal.
  10. The @CurrentIteration +/- n macro is supported for Azure Boards and Azure DevOps Server 2019 and later versions, and only when run from the web portal.

Query samples for select fields

The following table lists common query fields and their data type for which sample queries are provided. To determine the data type of a field, see Work item fields and attributes, List field attributes.

A

B

C

D-E-F

H-P

R

S

T

V-W

Notes:

  1. The Comment Count field is supported for TFS 2017 and later versions.