工作项目描述没有获得价值

时间:2017-10-23 09:54:10

标签: c# visual-studio tfs

我使用以下代码以编程方式将WorkItem发送至tfs

        const String username = "user";
        const String password = "123";

        Uri url = new Uri("myurl");

        NetworkCredential nc = new NetworkCredential();
        nc.UserName = username;
        nc.Password = password;
        TfsTeamProjectCollection coll = new TfsTeamProjectCollection(url, nc);
        coll.EnsureAuthenticated();

        WorkItemStore workItemStore = coll.GetService<WorkItemStore>();
        Project teamproject = workItemStore.Projects["Service"];
        WorkItemType workItemType = teamproject.WorkItemTypes["Bug"];

        WorkItem wi = new WorkItem(workItemType);

        wi.Title = "thi has sent from Code";
        wi.Description = "please remove this work Item";
        wi.Tags = "c#";

        wi.Save();

但是当我检查workItem时,它只有标题,并且描述中没有任何内容。 我尝试在下面设置描述,但它不起作用。

      wi.Fields[CoreField.Description].Value = "<p>hey hey</p> ";

enter image description here

1 个答案:

答案 0 :(得分:1)

对于“错误”,该字段不是“说明”。它应该是“重新开始重现”,就像上图所示。

如下设置添加ReproSteps for bug:

wi.Fields["Microsoft.VSTS.TCM.ReproSteps"].Value = "set value here";