Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to query history in TFS?

Tags:

tfs

history

I know every TFS work item shows it's history, but it's "find the difference" painful process... How can I query by history to see WHAT was actually changed? Assume I don't know what was changed, or that multiple items were changed, so I can't use an actual word or phrase

like image 542
mlarisa Avatar asked Sep 16 '14 21:09

mlarisa


People also ask

Can you query history in Azure DevOps?

You can use either the web portal or Team Explorer to view the history of a work item or find work items based on the contents of the History field. When you run a search on the contents of the History field, it returns only work items that have changes recorded in that field.

How do I get WIQL from a query?

By installing the Wiql Editor Marketplace extension, you can construct your queries using the Query Editor and then view the WIQL syntax. You can then copy and modify the WIQL syntax and run the query using the Wiql Playground hub added to Boards.

How to check history in Azure DevOps?

To display the History window: In Source Control Explorer, select an item, open its shortcut menu, and then choose View History.

How do I query Azure DevOps?

To run any query, expand a folder and choose the title of the query. The view opens to display the query Results. You can also run a query by using the Azure DevOps command line interface. The Queries page, as with other web portal pages, remembers the view you last navigated to and returns you to that view.


2 Answers

Are you using Visual Studio Online (VSO)? If so, you can use the REST API and specifically the Updates method to see what changed in each revision of a work item. This will let you easily see the difference between two consecutive revisions.

If you want the changes between, say, revision 3 and revision 8 then you will need to aggregate the individual revision changes yourself to see the net difference between those two revisions.

If you're using an on-premise TFS server then you'll be using the .NET API. For that, have a look at this CodeProject article for more information, but the basics are that you need to do something like this to see all the revision information:

var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(
                    new Uri("https://tfs2010:8080/defaultcollection"));
var service = tfs.GetService<WorkItemStore>();
var workItem = service.GetWorkItem(id);
foreach (Revision revision in workItem.Revisions)
{
  foreach (Field field in wi.Fields)
  {
    //Do something interesting here instead
    var change = revision.Fields[field.Name].Value
  }
}

From there, it's up to you to work out what information you're actually interested in.

like image 145
Richard Banks Avatar answered Sep 24 '22 21:09

Richard Banks


have a look at the: work item history visualizer

also, there's get-tfsitemhistory

like image 41
timB33 Avatar answered Sep 25 '22 21:09

timB33