如何以编程方式将文件附加到TFS工作项

问题描述 投票:2回答:2

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

tfs tfs-sdk
2个回答
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();

0
投票

如果您是download the Visual Studio SDK,则应该有一个使用Work Items and attachments using the TFS API的示例。

© www.soinside.com 2019 - 2024. All rights reserved.