Export (0) Print
Expand All

Example Work Item Queries

You can use the examples provided in this topic to better understand how to construct certain types of work item queries.

In this topic

Requirements

  • You must be a member of the Readers group, or your View work items in this node permission must be set to Allow for each team project in the query. For more information, see Find Bugs, Tasks, and Other Work Items.

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.

To find items modified today or recently

  • Search for work items modified today by adding a clause similar to the one shown below:

    And/Or

    Field

    Operator

    Value

    And

    Changed Date

    =

    @Today

    Note Note

    You can modify this variable to search for the current date minus a number of days. For example, to find all items started in the last week, you would set the Field column to Activated Date, the Operator column to >=, and the Value column to @Today - 7.

To find items modified on a specific date

  • Search for work items modified on a specific date by adding a query clause according to the following guidelines:

    And/Or

    Field

    Operator

    Value

    And

    Changed Date

    =

    12/01/2011

    In the Value column, type the date that follows the format accepted by your computer's operating system.

To find items modified during a specific time period

  • Search for work items modified over a range of dates by adding two query clauses and then grouping them, according to the following guidelines.

    And/Or

    Field

    Operator

    Value

    Changed Date

    >

    12/01/2011

    And

    Changed Date

    <=

    12/22/2011

    • Select a Field that is a date data type to add or modify a query clause, such as Created Date, Changed Date, or Closed Date.

    • In the Operator column, select either > (Greater Than), if you only want items after the date, or >= (Greater Than or Equal To) if you want items that include the date that you select.

    • In the Value column, enter the first date in the range of dates that follows the date format accepted by your computer's operating system.

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 distribution groups defined in Team Foundation Server, a category of work item types, or find all active bugs assigned to my reports.

To find work items based on a value that belongs to a group

  1. You can search for work items that are as follows:

    • Assigned to someone who belongs to the Project Administrators group, add the following clause:

      And/Or

      Field

      Operator

      Value

      And

      Assigned To

      In Group

      Project Administrators

    • Active and assigned to someone who reports to you, add the following clauses:

      And/Or

      Field

      Operator

      Value

      And

      State

      =

      Active

      And

      Assigned To

      In Group

      <My Direct Reports Distribution Group>

  2. Choose Run Query, and check the query results.

If you are working on several team projects in Team Foundation Server, you might want to search through all of them with a single query. To perform this procedure, you must be a member of the Readers group or have the View work items in this node permission set to Allow for each team project in the query.

To query several team projects

  1. In the first query clause, enter the values shown in the following table:

    And/Or

    Field

    Operator

    Value

     

    Team Project

    In

    <first team project name>, <second team project name>, ...

    Important note Important

    Separate the team project names with the list separator that corresponds to the regional settings defined for your client computer, for example, a comma(,).

  2. Enter other query clauses as desired.

  3. Run the query.

Show:
© 2014 Microsoft