我在asp.net中创建了代理并从java调用它。感谢您的支持。现在,我想查询工作项历史记录以获取所有更改事件。举个例子。如果我更改了bug的受理人,正如它在Studio 2010的历史列中所示,我想查询历史记录,这应该导致xyz workitem已从旧值更改为新值。我试图查询WorkItems如下:
String queryWorkItemByDate =“SELECT * FROM WorkItems WHERE [System.TeamProject] ='” + projectName +“'和[System.WorkItemType] ='Bug'和[System.ChangedDate]> ='6/22/2010 6:00:00 PM'”;
但是,此查询提供当前工作项状态而非历史记录。如何使用对象模型查询WorkItem History?
问候。
Riddhi Shah
答案 0 :(得分:2)
您将需要查看嵌入式修订集合以查看更改内容。
TeamFoundationServer tfs = new TeamFoundationServer("http://tfs:8080");
tfs.EnsureAuthenticated();
WorkItemStore wis = tfs.GetService<WorkItemStore>();
var results = wis.Query("select * from workitems where [System.WorkitemType] = 'Bug'");
WorkItem wi = results[0];
foreach (Revision r in wi.Revisions)
{
System.Diagnostics.Debug.WriteLine("Revisions:");
for(int i = 0; i < r.Fields.Count; i++)
{
string revisionText = string.Format("Field {0} was '{1}' and is now '{2}'",
r.Fields[i].Name,
r.Fields[i].OriginalValue,
r.Fields[i].Value);
System.Diagnostics.Debug.WriteLine(revisionText);
}
}