Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a file list from TFS

Tags:

c#

tfs

I'm trying to figure out how to get a list of files from a specific folder ("$/theproject/trunk/setup/") in TFS without putting them in the local folder.

So far I've managed to connect, create a workspace and a working folder:

        var server = RegisteredTfsConnections.GetProjectCollection(new Uri("http://hostname:8080/"));
        var projects = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(server);
        var versionControl = (VersionControlServer)projects.GetService(typeof(VersionControlServer));

        var workspace = versionControl.CreateWorkspace(AppDomain.CurrentDomain.FriendlyName + "-installer", versionControl.AuthorizedUser);
        try
        {
            WorkingFolder folder = new WorkingFolder("$/theproject/trunk/setup/", "C:\\aTempFolder");
            workspace.CreateMapping(folder);

            //this would get all files to the local folder, right?
            //what should I do instead to just get a file list?
            workspace.Get(); 

        }
        finally
        {
            workspace.Delete();
        }
like image 681
jgauffin Avatar asked Jan 21 '11 10:01

jgauffin


People also ask

How to download project from Team foundation server?

You can get the TFS project from Visual Studio. First, you have to connect the project via Team Explorer in Visual Studio then add a server and click 'select team project' and you're done. It is downloaded to your PC. You can find a documentation here.


1 Answers

Try this:

ItemSet items = versionControl.GetItems(folder.ServerItem, RecursionType.Full);
like image 81
frennky Avatar answered Oct 02 '22 03:10

frennky