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

最佳答案

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();

08-26 18:38