访问工作项的看板列(特定于团队的字段) [英] Access the Kanban Column (a Team-Specific Field) for a Work Item

查看:12
本文介绍了访问工作项的看板列(特定于团队的字段)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法使用 TFS 2012 API 以编程方式访问 WorkItem 的看板列"?

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

使用 Scrum 2.2 模板,每当在看板的看板列之间拖动工作项时,错误或产品待办列表项的历史记录将[MyProjectMyTeam] 看板列"显示为已更改的字段,但该字段不是在通过 TFS API 专门检索工作项时可访问.

Using the Scrum 2.2 template, the history of a Bug or Product Backlog Item shows "[MyProjectMyTeam] Kanban Column" as a changed field whenever a work item is dragged between Kanban columns on the Board, but the field is not accessible when specifically retrieving a work item through the TFS API.

Microsoft.TeamFoundation.Framework.Server.ISubscriber 上实现 ProcessEvent 方法时,它还显示为 WorkItemChangedEvent 对象中的更改字段.代码>界面.

It also shows up as a changed field in the WorkItemChangedEvent object when implementing the ProcessEvent method on the Microsoft.TeamFoundation.Framework.Server.ISubscriber interface.

解决方法:一位同事发现了一篇关于创建的博客文章一个只读的自定义字段,用于保留看板列的值,利用 WorkItemChangedEvent 来捕获最新值.然后就可以在此列上进行查询.这种方法的一个问题是只能跟踪单个团队的看板列.

Workaround: A coworker found a blogpost about creating a read-only custom field to persist the value of the Kanban Column, taking advantage of the WorkItemChangedEvent to capture the latest value. It is then possible to query on this column. One problem with this approach is that only a single team's Kanban Column can be tracked.

更新:根据这个博客文章,看板列不是一个字段,而是一个WIT 扩展".这可能有助于找到答案.

Update: According to this blogpost, the Kanban Column is not a field, rather a "WIT Extension". This may help lead to an answer.

推荐答案

我找到了一种使用 TFS 2013 API 在 ISubscriber.ProcessEvent 方法中读取值的方法:

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];
        }
    }
}

这篇关于访问工作项的看板列(特定于团队的字段)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆