How to delete a attachment in attachments collection using TFS api 2010, 2012. I only know wi.Attachments.Clear(); to delete all attachment.
Asked
Active
Viewed 1,054 times
1 Answers
0
How about this way? I tried and succeeded.
//wi is a WorkItem
wi.Open();
for (int i = wi.Attachments.Count - 1; i >= 0; i--)
{
if (wi.Attachments[i].Name == "Attach1.txt")
wi.Attachments.RemoveAt(i);
}
wi.Save();
wi.Close();

Lei Yang
- 3,970
- 6
- 38
- 59
-
Good solution, You have just saved my life – knowwebapp.com Mar 25 '13 at 19:47