This C# sample works in machines where Team Explorer 2008 is installed. This
sample uses object model from Team Explorer 2008 to access TFS. It will
demostrate how to programatically manage work items. You may want to select a
team project for experimental purpose. Set the team project name and TFS URL in
Team Explorer 2008 must be installed on the machine. You can download it from:
Otherwise the project may not be able to reference to work item object model.
1. Create a new Windows Console application named "CSTFSWorkItemObjectModel".
2. Add reference to Microsoft.TeamFoundation.Client.dll and
Microsoft.TeamFoundation.WorkItemTracking.Client.dll. They are located in
%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies.
3. Add an App.config to the solution with the following content. Please replace
TfsUrl value to your TFS server and TeamProject value to an existing team
project for experiment.
<?xml version="1.0" encoding="utf-8" ?>
<add key="TfsUrl" value="http://170112m3:8080"/>
<add key="TeamProject" value="WIT Test"/>
4. Copy the content in the Programs.cs in the sample to your project.
7. To build and debug this sample you can press F5 from your keyboard, or click
Debug menu and choose "Start Debugging".
1. Import a work item type "My WIT" to the specified team project.
2. Create work items of type "My WIT" in the specified team project.
3. Create a work item query "My WITs" in the specified team project.
team project and create work items.
1. To destroy a work item, you can use "tfpt destroywi" from TFS power tool.
2. To destroy a work item type, you can use "tfpt destroywitd" from TFS power tool.
3. To delete a work item query, you can right click the query in Team Explorer and
1. Work Item Tracking Extensibility