We recommend using Visual Studio 2017
This documentation is archived and is not being maintained.

Add Work Item Queries to a Process Template

By adding work item queries to your process template, you can define the initial set of team queries and query folder structure for a team project. All team members use queries to find the bugs, tasks, and other work items on which they must take action.

Work item queries specify criteria for generating a list of work items, such as a list of active bugs or closed tasks. Files for work item queries have a .wiq extension and are stored in the Queries subfolder of the WorkItem Tracking folder for Microsoft Solutions Framework (MSF) process templates.

Important noteImportant

The process templates for MSF define several queries. For more information, see Team Queries (Agile) and Team Queries (CMMI). Query definitions depend on the fields and types of work items in the process template. Also, some workbooks that are uploaded within the Portal plug-in depend on the query definitions.

You specify the query definitions to upload as a task within the WorkItemTracking plug-in. This task may be required because several artifacts in a process template may depend on a query. In addition, the task to upload queries depends on the successful completion of the task for uploading work item types. You specify each query file to upload within the taskXml element.

In this topic

After a team project is created from the process template, you can add, remove, and change the team queries by using the Query Editor. For more information, see Finding Bugs, Tasks, and Other Work Items.

For information about how to assign query permissions to groups, see Controlling Access to Functional Areas. For information about how to create query folders, see Defining and Customizing Objects for Tracking Work Items By Using the Work Item Tracking Plug-in.

Each query definition must be specified in its own file with an extension of .wiq, using the WorkItemQuery parent element, and conform to the schema that is defined in the wiq.xsd file. You can download the schema files for tracking work items from the following page on the Microsoft website: Process Template and Work Item Schemas for Visual Studio Team Foundation.

The following example shows the high-level syntax structure that defines a work item query:

<WorkItemQuery Version="1">

For more information about how to create a work item query to add to a process template, see Define a Work Item Query to Add to a Process Template.

Back to top

To include the work item queries in the process template, create one or more tasks in the workitems.xml file, which you can find in the \WorkItem Tracking folder, which is in the folder to which you downloaded your process template. Use the Query element to specify the file for the work item query. For example, the following XML specifies the query that is defined in the ActiveBugs.wiq file to be uploaded and named Active Bugs.

<Query name="Active Bugs" fileName="WorkItem Tracking\Queries\ActiveBugs.wiq" />

You add the set of queries to upload as a task in the WorkItemTracking plug-in.

The following example shows how to specify a task to create a query folder that is named Product Management and upload a query that is named All User Stories to that folder.

<task id="Queries" name="Stored Query Definitions" plugin="Microsoft.ProjectCreationWizard.WorkItemTracking" completionMessage=" Work item queries uploaded" />
      <dependency taskId="WITs" />
         <QueryFolder name="Product Management" >
            <Query name="All User Stories" fileName="WorkItem Tracking\Queries\AllUserStories.wiq" />
         . . .

For more information, see Defining and Customizing Objects for Tracking Work Items By Using the Work Item Tracking Plug-in.

Back to top

The following syntax shows the structure of the QUERIES element and its child elements.

   <Permission />
   <QueryFolder >
      <Query />

The following table describes the elements that you use to specify the query folder structure, permissions, and queries to upload. You specify these elements within a taskXml container element in the WorkItemTracking plug-in file.





<permission allow="ListOfPermissions" identity="GroupName" />

Optional child element of Query.

Specifies the default permissions that are assigned to team queries. For more information, see Assigning Permissions for Work Item Queries.


<Query name="QueryName" fileName="QueryFilePathName" />

As the following example shows, you can upload the query that is labeled “Active Bugs” and that is defined in the ActiveBugs.wiq file:

<Query name="Active Bugs" fileName="WorkItem Tracking\Queries\ActiveBugs.wiq" />

Required child element of QUERIES.

Specifies the name and the path of the .wiq file that defines a query to upload.


<QueryFolder name="FolderName">
   <Query />

Optional child element of QUERIES.

Specifies the name of a query folder.


   . . . 

Optional child element of the taskXml element for the WorkItemTracking plug-in.

Specifies which query definition files to use to create default queries.

Back to top