Share via


Working With Work Item Queries

You use searches, or queries, to locate work items based on the information in the work item forms. Work item queries are available in Team Explorer or Team System Web Access from the Work Items node of your team project.

Work item queries are stored in the Team Foundation database for the team project. You can also save a query to a file, and then copy or mail the query to anyone with access to Team Foundation Server and the team project. Query files have the file name extension .wiq.

There are two types of queries you can use in Team Foundation Server: Team Queries and My Queries. Both queries are stored on the Team Foundation Server.

  • Team Queries   These queries are available to everyone in your team project. Team Queries can only be created and modified by people who have been assigned permissions to create them by your team project administrator.

  • My Queries   These queries are available only to you. For more information, see Creating Work Item Queries.

You can target your search by using a single query clause that looks for specific values in the fields on the work item form. You can also search by creating more complex queries that involve several query clauses.

Creating Query Clauses

Each line of a query is called a query clause. Query clauses are built by using the columns in the query to find specific information in work item fields. You select the work item field in which to search, an operator that indicates how to search for the value, and then the value for which to search. You connect query clauses by using the And/Or column. Choose And if you want work items that match both clauses. Choose Or if you want work items that contain one or the other clause.

To return the results that you want, try by changing the query clause organization as described here:

  • **Add, remove, and move query clauses   **Test the results as you change the query to make sure that you are obtaining the results that you intended. You can get unexpected results when a query clause, operator, or And/Or is in the wrong order in the query.

  • **Group clauses   **Clauses can be grouped to operate as a single unit separate from the rest of the query; like putting parentheses around an expression in a mathematical equation or logic statement. Grouping the clauses is useful when you are building complex queries.

  • **Copy and paste clauses   **You can copy and paste clauses to speed up the query building process.

In This Section

See Also

Other Resources

Adding and Modifying Work Items