Use the search box to create a work item query

Last Update: 4/4/2017

Team Services | TFS 2017 | TFS 2015 | TFS 2013

You can initiate your query from the work item search box. You can find items using shortcut filters or by specifying keywords or phrases, specific fields/field values, assignment or date modifications, or using Equals, Contains, and Not operators.

Search box queries automatically scope to the items defined to the team project you're currently connected to. To search across team projects, use the query editor. Also, searching is not case-sensitive.

NOTE

The images you see from your web portal may differ from the images you see in this topic. These differences result from updates made to Team Services or your on-premises TFS, options that you or your admin have enabled, and which process was chosen when creating your team project—Agile, Scrum, or CMMI. However, the basic functionality available to you remains the same unless explicitly mentioned.

Work items are denoted with icons for Team Services and TFS 2017.2 and later versions. For an overview of changes in the navigation experience and working within the user and administration contexts, see Work in the web portal.

NOTE

Feature availability: You can add the Code Search extension to Team Services or by upgrading to TFS 2017.

If you've added the Code Search extension to Team Services or TFS 2017, you'll notice that the search box moves to the top row, and you can quickly switch between work item and code searches.

The search box retains the last used search context for each hub. To learn more about code search, see Get started with Code Search.

IMPORTANT

If your admin has installed the Work item search extension, the search box will perform an adhoc query using the extension. You'll no longer be able to initiate a managed search. Instead, you'll need to open the Work>Queries page and construct a query. To learn more, see Adhoc vs managed work item queries.

Type the ID in the Search work items box and then choose the search icon. The Search work items box is available from a team project context.

Team Services and TFS 2017

Search Work Items Text Box

Click within the box to view the set of filters for assignment, workflow state, keyword, or work item type.

TFS 2015

Search Work Items Text Box

Use the context menu icon context menu to add a filter based on assignment or workflow status, a keyword or work item type.

For example, enter A=@Me T=Task to list all tasks assigned to you.

Use shortcut filters

Open the Context Menu Icon context menu and select an option.

Context menu for search box (web portal)

Search box shortcut menu (web portal)

Context menu for search box (Team Explorer)

Search box menu (Team Explorer)

You can enter or select one or more of the following shortcut identifiers:

  • A =for Assigned To, (for example, A:Annie or A=@me).

  • C for = Created By, (for example, C:Peter or C=@me).

  • S for = State, (for example, S=New).

  • T for = Work Item Type, (for example, T=Task).

Use the @Me and @Today macros to specify your user name or today's date.

Use the =, :, and operators to specify the operations Equals, Contains, and Not, respectively.

Finding work items using the search box (Team Explorer)

Find a work item using the search text box

You can combine shortcuts and use search operators within the search box.

In Team Explorer, use the Search box clear icon (Team Explorer) Clear button to remove content from the search box. To switch your context to the search box from within Visual Studio, enter Ctrl+'.

Find items based on keywords or phrases

Keywords or phrases that you type into the search box return a list of work items that contain those keywords or phrases in the Description, Repro Steps, or Title fields. You must enclose each phrase in quotation marks.

In the Search work items box, type a keyword or phrase that appears in the Title, Description, or Repro Steps fields for the work items of interest.

Enclose multiple words in quotation marks.

For example, to find work items with the specified keywords in the Title or Description fields:

  • For the keyword "duplication" enter duplication.
  • For the phrase "Getting Started" enter "Getting Started".
  • For the phrase "Getting Started" or the keyword "feature" enter feature "Getting Started".
Filter for items that contain these keywords or phrases: Type the following string:
duplication duplication
Getting Started "Getting Started"
feature and Getting Started feature "Getting Started"

You can perform partial or exact match queries on a keyword or a phrase contained within any text field. Or, you can perform a full-text search query by filtering on keywords and phrases contained within the full-text search index. Team Foundation automatically indexes all long-text fields with a data type of PlainText and HTML and the Title field for full-text search.

Find items based on specific fields and field values

To find work items based on a keyword or phrase contained within other text string fields, specify either the friendly name or the reference name of the field. Enclose each phrase in quotation marks. You can determine the friendly name of a field by hovering over the field within a work item form. To determine the reference name of commonly used fields or to find a field that is not listed on the form, see Work item field index.

Filter for items that meet this criteria: Type the following string:
Contains one attached file. System.AttachedFileCount=1
Cut user stories. T:Story Reason=Cut
Or
T="User Story" System.Reason=Cut
Resolved by Peter. "Resolved By":Peter
Or
Microsoft.VSTS.Common.ResolvedBy:Peter
Modified today. "Changed Date"=@Today
Created yesterday as a test activity. "Created Date"=@Today-1 Activity=Test
NOTE

Some fields, such as History and Description, do not support partial word text searches. For example, if the History field contains the phrase reproducible behavior and you search for History:repro the work item will not be found. However, if you search for the complete string History:reproducible the work item will be found.

Use @Me or @Today macros

The @Me macro expands to the full name of the current user in any work item search. The @Me macro is especially useful for creating a search that you can share with other users, and it can simplify your work by reducing the number of characters you must type to specify your own user name. For a description of all macros, see Query fields, operators, and macros, Query macros or variables.

Filter for Type the following string
Currently assigned to you A=@Me
Created by you C=@Me
Resolved yesterday "Resolved Date"=@Today-1
Modified 7 days ago System.ChangedDate=@Today-7
Created yesterday under the Phone Saver team            Created Date _ = _ @Today-1
And _ Area Path _ = _ FabrikamFiber\Phone Saver

Use Equals, Contains, and Not operators

Use these search operators to specify search criteria:

   = (EQUALS) to search for exact matches of text.
   : (CONTAINS) to search for partial matches of text.
    (NOT) to exclude work items that contain certain text. The NOT operator can only be used with field names.

The following examples show how to use operators when you create a search string.

Filter for items that meet this criteria: Type the following string:
Assigned to Peter and not Active. A:Peter -S=Active
In which the Activity field was not Development. - Activity=Development
Resolved by Peter. "Resolved By":Peter
Contain the keyword triage in the title or description, are not assigned to you, and are not closed. triage -A=@me -S=Closed
Active bugs that are assigned to you that do not contain the keyword bugbash in the title. S=Active T=bug A=@Me -Title:bugbash

Does the search box support less than/greater than operators?

No. The search box doesn't recognize comparison operators such as greater than (>) or less than (<). It translates queries with these operators into a search phrase.