TFS SDK 2010 – Part 2 - Get a work item

by Ewald Hofman 11. December 2009 04:23

In Part 1 I have described how to access the Application Instance of the TFS server. This post describes how you can create access to your work items:

In order to get access to the work items, add a reference to:

  • Microsoft.TeamFoundation.WorkItemTracking.Client.dll

You can find the dll’s in C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\ReferenceAssemblies\v2.0

Then you have to add the following using statements:

using Microsoft.TeamFoundation.WorkItemTracking.Client;

You can now enumerate the values of a work item with the following code:

// Get the work item store
WorkItemStore wiStore = tfai.GetTeamFoundationServer(tpc.Id).GetService<WorkItemStore>();

// Get the work item with the Id 1
WorkItem wi = wiStore.GetWorkItem(1);

// Write the name and value for all fields in the work item
foreach (Field fd in wi.Fields)
{
    Console.WriteLine("{0}: {1}", fd.Name, fd.Value);
}

All code examples are based on Beta 2 and are subject to change.

Tags:

TFS SDK | VSTS 2010

Comments are closed

Powered by BlogEngine.NET 1.6.1.0
Theme by Mads Kristensen


ClusterMap

Widget Statistics not found.

There is an error in XML document (0, 0).X

Recent comments

Comment RSS