A Tech Log

November 10, 2008

TFS: Getting workitem history from the api

Filed under: Development — adallow @ 11:14 am
Tags:

First get the workitem in code (as per TFS code samples) then:

foreach(Revision rev in wrkitem.Revisions)

{

foreach(Field f in rev.Fields)

{

Console.WriteLine(“{0} = {1}\n”,f.Name,f.Value);

}

}

There is also the OriginalValue property on fields as an alternative (for some styles of history access):

foreach(Field f in rev.Fields)
{
if(!Object.Equals(f.Value, f.OriginalValue))
{
Console.WriteLine(“{0}: {1} -> {2}”, f.Name, f.OriginalValue, f.Value);
}
}


About these ads

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Rubric Theme Blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: