0

How to delete a attachment in attachments collection using TFS api 2010, 2012. I only know wi.Attachments.Clear(); to delete all attachment.

knowwebapp.com
  • 95
  • 4
  • 16

1 Answers1

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