如何为TFS中没有数据的字段更新工作项

问题描述 投票:0回答:1

我正在使用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.

    }
c# tfs tfs-workitem
1个回答
0
投票

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

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

详细代码片段,请看这个类似的问题:How to update a custom TFS field programmatically

© www.soinside.com 2019 - 2024. All rights reserved.