TFS API - How to fetch work item(s) from specific Team Project

后端 未结 2 1220
长情又很酷
长情又很酷 2021-02-01 01:58

I am trying to query a single team project in the main TfsTeamProjectCollection which contains 194 Team Projects in total. I know exactly how to get a WorkIte

2条回答
  •  粉色の甜心
    2021-02-01 02:36

    You could try something like this for getting all WIs within teamProject:

    WorkItemCollection workItemCollection = workItemStore.Query(
         " SELECT [System.Id], [System.WorkItemType],"+    
         " [System.State], [System.AssignedTo], [System.Title] "+ 
         " FROM WorkItems " +
         " WHERE [System.TeamProject] = '" + teamProject.Name +
        "' ORDER BY [System.WorkItemType], [System.Id]");
    

    And this to get a specific WorkItem ID:

    WorkItem workItem = workItemStore.GetWorkItem(555);
    

提交回复
热议问题