Team Foundation Server 2012 (WorkItem object does not contain „AssignedTo“ property)

StackOverflow https://stackoverflow.com/questions/21531554

  •  06-10-2022
  •  | 
  •  

문제

Code snippet:

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

I have found examples of wiql queries that have [Assignet To] in attributes list,

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'

but each time such wiql query is executed it returns array of WorkItems without desired property. Therefore my original problem remains.

What to do?

도움이 되었습니까?

해결책

The AssignedTo Property is nested inside another property: Fields. You can key into that fields collection by referenceName (System.AssignedTo, in this case), something like wi.Fields["System.AssignedTo"].Value where wi is a WorkItem. You can also use Linq to operate on the entire WorkItemCollection instead of on a single work item, if that's what you're after.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top