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