Share via


Work Item Explorer Sample

The Work Item Query sample includes three C# project files. Together, the projects create an alternative user interface for finding work items in a team project.

Project files:

  • WitExplorerForm.cs

  • WorkItemForm.cs

  • WorkItemsForm.cs

To open this sample, from the Sample Browser, right click C# Example.WorkItemExplorer, and choose Open in VS.

You can use the sample to understand the following concepts:

  • Create a Windows application to query for WorkItemTypes within specific team projects.

  • Show a list of stored queries.

  • Enter new queries.

  • Edit stored queries before running the queries.

  • Return a list of WorkItems from a query.

  • Edit and save WorkItems.

  • View all WorkItem revisions.

  • Find and open Individual WorkItems using the WorkItem ID.

To build and run the sample

  1. In the Sample Browser, right click C# Example.WorkItemExplorer, and choose Open in VS.

  2. Press F5 to build the sample and then run it.

Requirements

  • Team Foundation Server installation and the name of the server.

  • A computer that has Visual Studio installed.

  • A computer that has Team Explorer installed.

Demonstrates

WitExplorerForm.cs project

  • Enter a server name, and the projects on that server will be put in the Project combo box.

  • Select a project, and the project's list of WorkItemTypes will be put in the Work Item Type combo box.

  • New creates a new WorkItem.

    An empty WorkItemForm will appear to enter the new WorkItem.

  • Entering a WorkItem ID in the Get Work Item field displays a specific WorkItem.

  • The WorkItem will appear in a WorkItemForm.

  • StoredQueries for the project are put in the Team Queries TreeView field.

  • Clicking the specific StoredQuery copies the stored query to the Query String text box.

  • The query string can also be entered in the Query String, or an existing StoredQuery can be edited in the Query String text box.

  • Click Run to run the query.

  • The query results will appear in a list box in the WorkItemsForm.

WorkItemForm.cs Project

  • Displays a WorkItem's fields, their current values, and original values, in a ListView.

  • Selecting a Field will show:

    • The field type.

    • The field value with the Value combo box set to show the Allowed Values, if a list of allowed values exists in the FieldDefinition.

    • The Boolean values Required, Editable, Valid, List Items Only, and Dirty.

    • The Reference Name.

    • Set will change the WorkItem's field.

    • Revision will retrieve previous revisions of the WorkItem.

    • Save will save the WorkItem to the WorkItemStore.

WorkItemsForm.cs

  • Lists WorkItems returned from a Query.

  • Double-click a WorkItem to bring it up in the WorkItemForm.

See Also

Tasks

How to: Get WorkItems with a WIQL Query

Other Resources

Samples - Work Item Tracking

Work Item Tracking Extensibility

Work Item Query Language