I have created an application for my own purpose, that will retrieve all the files from TFS programatically. Code for files retrieval have been given here.
using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.VersionControl.Common; using Microsoft.TeamFoundation.VersionControl.Client; .... TeamFoundationServer tfs = new TeamFoundationServer("http://TFSServer:Port/", new System.Net.NetworkCredential("sUserName", "sPassword")); tfs.EnsureAuthenticated();
Workspace workspace = null; try { // Connect to TFS Source Control VersionControlServer vcs = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
// Create a Workspace string repository = txtWorkspace;
// location to check out files to: string workspacePath = @"" + "Folder";
workspace = vcs.CreateWorkspace("TestWorkSpace", vcs.AuthenticatedUser); WorkingFolder folder = new WorkingFolder(repository, workspacePath);
// Get Files workspace.CreateMapping(folder); workspace.Get(); } catch(Exception ex) { //Exception has to be handled here } finally { // clean up the workspace for subsequent passes. if (workspace != null) workspace.Delete(); }
|
No responses found. Be the first to respond and make money from revenue sharing program.
|