Work with a flat list (default) query

To easily find work items stored in Team Foundation Server, you and your team members can use predefined shared queries, as well as create, modify, and save new ones. Queries that you save under Team Queries appear on your home page and provide a quick update on your team’s progress. You can view, create, and run queries with Team Web Access and Team Explorer. You can also open queries in Microsoft Excel and Microsoft Project. You can save your queries to reuse later or share them with other team members.

Choose a Flat QueryFlat List of Work Items query when you want to do any of the following tasks:

  • Find a work item with an unknown ID.

  • Check the status or other column fields of several related work items.

  • Find work items that you want to link to other work items.

  • Export work items to Office Excel and Office Project for bulk updates to column fields.

  • Generate a report about a set of work items.

  • Perform bulk updates to column fields by using Team Web Access.

You can convert a flat list (Flat Query) query to either a Work Items and Direct Links (Direct Links Query) query or a Tree ofWork Items (Tree Query) query. See Work with linked dependencies (Direct Links) and Work with linked hierarchies (Tree of Work Items).


  • To create, save, or modify a query, you must be a member of the Contributors group or have the Edit work items in this node permission set to Allow. For more information about query permissions, see Find Bugs, Tasks, and Other Work Items.


The topic illustrates how to work in Team Explorer. You can perform similar procedures in Team Web Access, although the details differ slightly.

View a predefined, flat-list query

Each team project usually has several predefined shared queries based on the process template that was used to create the team project. The following illustration shows predefined shared queries for the Visual Studio Scrum process template.

View shared query (Team Explorer)

  1. In Team Explorer, choose Work Items, expand Shared Queries, and then expand a folder, for example the Current Sprint folder.

  2. Choose the query you want, and then choose Enter. Or, choose the shortcut menu and choose View results or Edit query.

    For example, the following illustration shows the results of running the Blocked Tasks query defined within the Visual Studio Scrum process template.

    Flat list query results (Team Explorer)

To learn more about working with work items in the Query Results view, see one of the following topics:

Create, modify, and save a query

You can create a new query or modify an existing one, add and remove columns, and change the sort order of columns. You can also save a query under the My Queries folder for your own use or under the Shared Queries folder for your team.

  1. On the Work Items page, choose the New Query link to create a query. To modify a query, open the query and choose the Edit Query button in Team Explorer, or the EDITOR link in Team Web Access. For example, the following illustration shows the Query Editor for Blocked Tasks.

    Flat List Query (Team Explorer)

  2. (Optional) To change the query type, select the Type of Query based on the type of view or work items that you want to find. See Selecting the right query tool for the task.

  3. Add, modify, insert, delete, and group clauses to filter the set of work items to meet your needs. Each clause starts with a Boolean operator (AND/OR), then a field, then the field operator, and finishes with a value for the field that you either select or type.

    To add a clause, choose Click here to add a new clause. If you want the clause to be treated as an Or clause, choose And, and then choose Or. For details about grouping clauses, see Add, remove, group, or ungroup query clauses.

    Choose or specify the values for Field, Operator, and Value. See Query Fields, Operators, Values, and Variables.

  4. Choose the Run Query (Team Explorer)Run button, and check the results.

  5. Repeat steps 3 and 4 until you get the results that you want. Group or ungroup clauses as needed. For more information, see Specify Query Filter Criteria.

  6. (Optional) Choose Column OptionsColumn Options to modify which columns appear in the query results or how the results are sorted.

    You might want to sort the query results to make it easier to find your data. For more information, see Add, Remove, Reorder, and Sort Columns.

  7. On the Query Editor toolbar, choose the SaveSave Query button.

  8. In the Save Query As dialog box, type a Name for your query.

  9. Choose the Server option, and then browse to the folder where you want to save the query.

    For example, you might choose to save a query under the Shared Queries folder so that other members of your team can access it. If the query is not relevant to other team members, then save it under My Queries.

  10. Choose the Save button.

    For more information, see Organize and Set Permissions on Work Item Queries.

See Also


Query Fields, Operators, Values, and Variables

Find Bugs, Tasks, and Other Work Items