How to: Create, Share, and Run Work Item Queries (Team System Web Access)

To find specific work items, you can create a query in Team System Web Access. When you create a query, you specify one or more criteria to define the results that the query should return. You can save queries to the My Queries or Team Queries folder. You can also share queries with team members by creating a URL version of the query and placing it in an e-mail message or by posting the query on a Web site. Team members can then open the query by clicking the URL.

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.

Creating Work Item Queries on Team Foundation Server

You can create a work item query and save it to the My Queries or Team Queries folder. If you save a query to the Team Queries folder, any team member can run the query by using Team Explorer or Team System Web Access.

To create a work item query and save it on Team Foundation Server

  1. In the Team System Web Access quick launch area, click the arrow next to My Queries, and then click New My Query.

    Note

    You can also create a public query by clicking the arrow next to Team Queries and then clicking New Team Query.

  2. Click each column in the query clause, and specify the criterion for the clause.

  3. To add another clause to the query, click Click to add a new clause, and specify the values for Field, Operator, and Value.

    You can add as many clauses as you want to narrow the query.

  4. Click Column Options to modify which columns appear in the query results or how the results are sorted.

  5. Click Run Query, and confirm that the query returned the expected results.

  6. Click Save.

  7. In the Save as Query dialog box, type a name for the query.

  8. Click My query if you want the query to only be visible to you, or click Team query if you want the query to be visible to everyone.

  9. In the Team Project list, click the team project in which to save the query.

  10. (optional) In the Description box, type any additional information to help describe the query.

  11. Click OK.

Creating and Sharing a Query by Specifying a URL

You can also create a query by constructing a URL that specifies one or more criteria to define the results. The URL is the query. You can share it with other team members by placing it in an e-mail message or by posting the query as a link on a Web site. When you or a team member clicks the URL, Team System Web Access runs the query and displays the results.

Note

To perform the following procedure, you must install Team System Web Access 2008 Service Pack 1.

To create a work item query by specifying a URL

  1. Open a Web browser window.

  2. In the Address bar, use the following syntax to specify a URL that defines a query to run.

    **http://Server:Port/q.aspx?pname=Project&wiql=**Work Item Query Language

    Replace the following arguments with values that are specific to your team's requirements:

    • Server   The name of the server that is running Team System Web Access

    • Port   The port number that Team System Web Access is using

    • Project   The name of the team project where you want the query to run

    • Work Item Query Language   Syntax that specifies the parameters of the query. For more information, see Work Item Query Language.

Note

You can generate the work item query language by creating the query in Team Explorer and then saving the query to a local file. Open the file in a text editor to see the work item query language for that query. For more information about how to save a work item query from Team Explorer, see How to: Save Work Item Queries.

Example

The following URL will run a query that returns all bugs from the AdventureWorksProject team project that were found in build number 9.0.30304. The columns in the results will be ID, Title, and State.

http://AdventureWorksServer:8090/q.aspx?pname=AdventureWorksProject&wiql=SELECT ID, Title, State FROM WorkItems WHERE [Team Project]='AdventureWorksProject' AND [Work Item Type]='Bug' AND [Found In]='9.0.30304'

Running a Query

You can run any query that is available in the Team Queries folder, or that you created in the My Queries folder. You can also run queries that are constructed as URLs.

To run a work item query

  • Perform one of the following steps:

    • In the Team System Web Access quick launch area, under My Queries or Team Queries, click a query.

    • Click the URL for the query you want to run.

    Team System Web Access displays the results of the query as a list of work items. 

See Also

Tasks

How to: Save a Query (Team System Web Access)

Concepts

Organizing Queries in Folders (Team System Web Access)

Other Resources

Work Item Query Language