簡體   English   中英

以編程方式“插入圖像”到TFS工作項

[英]Programmatically “Insert Image” to TFS Work Item

我一直在研究一個小型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();

為了進一步澄清,這里是我基本上要做的事情: 在此輸入圖像描述

在此輸入圖像描述

在此輸入圖像描述

我相信Description字段被編碼為各種HTML,並且圖像首先作為單獨的文件附加。 (歷史上它是一個文本字段,所以我找不到任何其他說法)

這是附加文件的示例

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM