将文件附加到TFS工作项的代码

时间:2009-06-08 05:40:35

标签: tfs

我想将文件附加到bug类型的工作项。在将错误详细信息保存到服务器时,我有这个附件。

2 个答案:

答案 0 :(得分:8)

TeamFoundationServer server = TeamFoundationServerFactory.GetServer("TFSRTM08");
WorkItemStore store = (WorkItemStore)server.GetService(typeof(WorkItemStore));
WorkItem workItem = store.Projects["ABC"].WorkItemTypes["Bug"].NewWorkItem();
//Set other work item properties.
workItem.Attachments.Add(new Attachment("C:\Temp\MyAttachment.txt", "Comment About Attachment"));
workItem.Save();

答案 1 :(得分:0)

如果你download the Visual Studio SDK,那里应该有一个例子来处理Work Items and attachments using the TFS API