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

后端 未结 3 1555
無奈伤痛
無奈伤痛 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

    I've found a way to read the value using the TFS 2013 API, inside the ISubscriber.ProcessEvent method:

    var workItemId = 12345;
    var extService = new WorkItemTypeExtensionService();
    var workItemService = new WorkItemService();
    var wit = workItemService.GetWorkItem(requestContext, workItemId);
    foreach (var wef in extService.GetExtensions(requestContext, wit.WorkItemTypeExtensionIds))
    {
        foreach (var field in wef.Fields)
        {
            if (field.LocalName == "Kanban Column" || field.LocalName == "Backlog items Column")
            {
                // Access the new column name
                var columnName = wit.LatestData[field.Field.FieldId];
            }
        }
    }
    

提交回复
热议问题