How to: Add New Work Item Queries

To find the specific work items that you need to complete your work, you can create a query in Query Builder. For more information on queries, see Querying for Work Items.

Required Permissions

To perform these procedures, you must be a member of the Readers group or have the View work items in this node permission set to Allow. To save a query as a team query, you must be a member of the Project Administrators group. For more information, see Team Foundation Server Permissions.

To add new work item queries to your team project

  1. Open your team project, expand the Work Items node, and then select Team Queries or My Queries.

  2. On the Team menu, click Add Query. A new query opens.

  3. Choose Click here to add a clause to add a new clause to your query.

  4. Click each column in the query clause to fill in the clause. If a column has a list of accepted values, a drop-down arrow appears when the column is selected. Click the drop-down arrow to select from the list. The following columns are available.

    Query Column How to complete

    And/Or

    Select And if this clause and the previous clause must be true to match a result. Select Or if either this clause or the previous clause must be true to match a result.

    Field

    The list for this field contains all of the searchable work item fields used in the current Team Foundation Server. Use as many clauses and fields as you need to get useful results. Press ALT+DOWN ARROW or type the field name that you want to choose.

    Operator

    Examples of operator choices are = (equal), <> (not equal to), > (greater than), < (less than), >= (greater than or equal to), <= (less than or equal to), In, Was Ever, Was Never, and Contains.

    Value

    Specifies the value that you are looking for in the specified field. If there is a list of values to choose from, click the drop-down arrow to select the one that you want. Team Foundation work item tracking includes some query variables to dynamically add values to your query. For more information, see Query Variables.

  5. Repeat steps 3 and 4 to add all of the values for which you want to search.

  6. On the query toolbar, click Run Query to run the query.

  7. Examine the query results and change your query as needed. You might want to sort the query results to make it easier to find your data. For more information, see How to: Add, Remove, and Sort Columns in Query Results.

    You should also save your query. For more information, see How to: Save Work Item Queries.

See Also

Tasks

How to: Add, Remove, and Sort Columns in Query Results
How to: Open an Existing Team Project
How to: Add or Remove Work Item Query Clauses
How to: Run Work Item Queries
How to: Save Work Item Queries
How to: Open Work Item Queries from E-Mail
How to: Edit Work Item Queries
How to: Rename Work Item Queries

Concepts

Query Variables

Other Resources

Working With Work Item Query Clauses