以编程方式“插入图像”到TFS工作项

时间:2013-03-18 20:07:09

标签: c# tfs tfs-sdk

我一直在研究一个小型的winform c#应用程序,它可以让我在TFS中创建一个工作项而无需实际进入TFS服务器。我已经想出了如何添加标题,附件,描述等。但我似乎无法弄清楚如何将本地图像插入TFS工作项“Repro Steps”字段。到目前为止,这是我的代码。

Uri collectionUri = new Uri("Server Adress" + project);
TfsTeamProjectCollection server = new TfsTeamProjectCollection(collectionUri);
WorkItemStore store = (WorkItemStore)server.GetService(typeof(WorkItemStore));

WorkItem workItem = store.Projects[SubProject].WorkItemTypes["Bug"].NewWorkItem();
workItem.Title = "Title";
workItem.IterationPath = "Iteration";
workItem.AreaPath = "Area"; 

workItem.Fields["repro steps"].Value = "Text"; //Here is where I would like to add my image

workItem.Fields["Assigned To"].Value = "Assigned";
workItem.Attachments.Add(new Attachment(File, "comment"));
workItem.Save();

为了进一步说明,我实际上是在尝试: enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:3)

我相信Description字段被编码为各种HTML,图像首先作为单独的文件附加。 (历史上它是一个文本字段,所以我找不到任何其他说法)

Here is an example of attaching a file

相关问题