You can get a version of a
Work Item[
^] and then look at the Attachments property that will get you a list of attachments associated with your WorkItem. You will require a reference to
Microsoft.TeamFoundation.Client[
^] and
Microsoft.TeamFoundation.WorkItemTracking.Client[
^]. A Code sample is below to get the Work Items.
using (Microsoft.TeamFoundation.Client.TeamFoundationServer tfs = Microsoft.TeamFoundation.Client.TeamFoundationServerFactory.GetServer(uri))
{
Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore wit = (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore)tfs.GetService(typeof(Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore));
Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemCollection result = wit.Query("SELECT * FROM WorkItems");
foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItem wi in result)
{
foreach (Microsoft.TeamFoundation.WorkItemTracking.Client.Attachment attachment in wi.Attachments)
{
}
}
}