Example work item queries
Use the following examples to better understand how to query for work items using the query editor.
Many dates are added to work item forms automatically. You can find work items that were changed on a given day or during a specific time period. Limiting the scope of a query also helps with performance by only returning those results that fit the date range that you want to include.
You can filter for work items by the date on which they were changed or for a specific time period. If you limit the scope of your query, it can help with performance by only returning those results that fit the date range that you want to include.
List items modified today or recently
Use one of the following clauses to filter items that have been modified recently.
List items modified on a specific date
Enter a date in the format accepted by your computer's operating system.
List items modified during a specific time period
Group two clauses to list items that have been modified between a date range.
To filter on items assigned to someone who belongs to a TFS group, use the In Group operator.
You can use the In Group or Not In Group operators to filter a query based on several values that are members of a group, or that are not members of a group. Examples of groups are TFS groups and work item categories.
Use Contains and Contains Words to list items that partially or exactly match the words or phrase that you enter.
Choose Contains or Does Not Contain to search against exact or partial matches of a word or phrase. Choose Contains Words or Does Not Contain Words to search against an exact phrase or to use the wildcard character, *. These operators use 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. For restrictions, see Full-text searches for server and collation requirements.
The following example shows a dependent linked query that returns items with dependencies on work managed by other teams and other team projects. Use this query to see all dependent work items that link to active Product Backlog Items or Bugs that have not been removed, closed, or completed. Only those dependent work items that are under a product area other than the Phone Save\Phone Customers are returned.
Why this works:
Removing the Team Project = @Project clause enables all dependent linked work items that match the filter criteria to be listed, no matter which team project they belong to in the collection.
Grouping each of two clauses returns all Product Backlog Items on the backlog or in progress, and the second grouped clause returns all Bugs on the backlog or in progress.
Grouping the two clauses with the OR operator at the start of the second clause returns work items that match either of the two filter criteria.
Choosing the Only return items that have the specified links returns only top-level work items that have dependencies.
Choosing Return links of any type returns all linked work items that match the filter criteria for linked work items, in this case, returning all work items that are not under the Phone Saver\Phone Customers area path, and aren't completed or removed.
The following image shows the query results that are returned.
A: Yes. For the Field, choose History and for the Operator field, choose Contains Words or Does Not Contain Words.
Enter the full text for the word that you want to search. The History field is indexed for full-text search. If you enter only a partial word, the query will not return work items that contain the full word. For example, if the History field contains the phrase reproducible behavior and you search for repro, the work item will not be found. However, if you search for the complete word reproducible, the work item will be found. You can also search for the string with a wild card, such as repro*.
Also, common words are ignored. The search engine ignores words that are defined as stopwords. For more information, see the following page on the Microsoft Web site: Stopwords and Stoplists.