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();
}
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.
Try this:
ItemSet items = versionControl.GetItems(folder.ServerItem, RecursionType.Full);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With