Access the Kanban Column (a Team-Specific Field) for a Work Item

后端 未结 3 1649
無奈伤痛
無奈伤痛 2021-01-04 21:01

Is there a way to programmatically access the \"Kanban Column\" for a WorkItem using the TFS 2012 API?

Using the Scrum 2.2 template, the history of a Bug or Product

3条回答
  •  佛祖请我去吃肉
    2021-01-04 21:20

    If you are prepared to dig into the database you can mine this information out. I don't fully understand the modelling of the teams in TFS yet but first you need to work out which field id the team of interest is storing the Kanban state in as follows (TFS 2012):


     USE Tfs_DefaultCollection
     SELECT TOP(10)
            MarkerField + 1 as FieldId,* 
     FROM tbl_WorkItemTypeExtensions with(nolock) 
     JOIN tbl_projects on tbl_WorkItemTypeExtensions.ProjectId = tbl_projects.project_id
     WHERE tbl_projects.project_name LIKE '%ProjectName%
    

    Then replace XXXXXXXX below with the FieldId discovered above


     SELECT TOP 1000 
            wid.Id, 
            wia.State, 
            wid.StringValue as Kanban, 
            wia.[Work Item Type], 
            wia.Title, 
            tn.Name as Iteration
     FROM tbl_WorkItemData wid with(nolock)
     JOIN WorkItemsAre wia on wia.ID = wid.Id
     JOIN TreeNodes tn on wia.IterationID = tn.ID
     WHERE FieldId = XXXXXXXX and RevisedDate = '9999-01-01 00:00:00.000'
     ORDER BY Id
    

提交回复
热议问题