【问题标题】:How to update workitem for a field with no data in TFS如何更新 TFS 中没有数据的字段的工作项
【发布时间】:2020-07-22 16:06:42
【问题描述】:

我正在使用 Microsoft.TeamFoundation.WorkItemTracking.Client 来修复一些问题。 请求是:我有一个没有数据的字段的工作项,现在我需要更新该字段的工作项,我该怎么做?

    public void UpdateWorkItem(int workItemId, Dictionary<string, string> values)
    {
        if (workItemId <= 0) return;

        var workItem = tfsStore.GetWorkItem(workItemId);

        //now if I use workItem.Fields["updatingKey"] it'll throw exception since the field updatingKey does not exist in the Fields of the workitem.

    }

【问题讨论】:

  • 嗨,凯文,有什么更新吗?只是检查提供的信息是否有帮助。如果我的回复有帮助或给出了正确的方向。感谢marking it as an answer,这也将帮助社区中的其他人。

标签: c# tfs tfs-workitem


【解决方案1】:

一旦您有了要修改的工作项,只需更改您需要更改的特定字段的值:

workitem.Fields["Custom Field"].Value = "New Value";

详细代码sn-p请看一下这个类似的问题:How to update a custom TFS field programmatically

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-07-28
    • 1970-01-01
    • 2018-05-26
    • 2010-11-15
    • 2014-03-01
    • 1970-01-01
    • 1970-01-01
    • 2013-03-05
    相关资源
    最近更新 更多