Team Foundation Server 2012(WorkItem对象不包含“AssignedTo”属性)

时间:2014-02-03 15:44:10

标签: tfs2012 tfs-workitem wiql

代码段:

string WIQL = "SELECT * FROM WorkItems WHERE [System.AssignedTo] = @Me AND [System.State] <> '400 CLOSED' ORDER BY [System.WorkItemType], [System.Id]";

List<WorkItem> w = getWorkItemsAsList(_workItemStore.Query(WIQL));

我找到了在属性列表中有[Assignet To]的wiql查询的例子,

SELECT [System.Id], [System.Title], [Area Path], [Iteration Path], [Priority], [Test Owner], [Assigned To],[System.State], [System.Reason]
FROM WorkItems
WHERE [System.WorkItemType] = 'Feature' and
      [Iteration Path] != '' and
      [Area Path] Under 'MyProject'

但是每次执行这样的wiql查询时,它都会返回没有所需属性的WorkItem数组。因此,我原来的问题仍然存在。

怎么办?

1 个答案:

答案 0 :(得分:0)

AssignedTo属性嵌套在另一个属性中:Fields。您可以通过referenceName(在本例中为System.AssignedTo)键入该字段集合,类似于wi.Fields [“System.AssignedTo”]。值wi是WorkItem。您也可以使用Linq来操作整个WorkItemCollection,而不是单个工作项,如果这是您所追求的。