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);
}
}


Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.