Programmatically Download Attachments from TFS
I created this short snippet of code the other day in reference to a forum question on how to retrieve the linked items for a given work item. The code below uses the TFS Object Model to retrieve a specific work item (in this case, item #16) and save all attachments to the local file system. Code Snippetusing Microsoft.TeamFoundation.Client;using Microsoft.TeamFoundation.Server;using Microsoft.TeamFoundation.WorkItemTracking.Client;using System;using System.IO;namespace DTTFSLib{public class WorkItemTest {public WorkItemTest(string serverName) {// Connect to the desired Team Foundation Server TeamFoundationServer tfsServer = new TeamFoundationServer(serverName);// Authenticate with the Team Foundation Server tfsServer.Authenticate();// Get a reference to a Work Item Store WorkItemStore workItemStore =…
