Question

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

Était-ce utile?

La solution

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();
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top