I have a piece of code that sets up a work space and download files from tfs work space programmatically. I want to extend to specify what solutions can I download in that work space. Any ideas how I can do this?
private GetStatus DownloadLatestFiles()
{
Workspace workspace = null;
try
{
workspace = SetupWorkSpace();
workspace.Map(_repositoryCredentials.RepositoryProjectPath, _repositoryCredentials.WorkingDirectory);
GetRequest request = new GetRequest(new ItemSpec(_repositoryCredentials.RepositoryProjectPath, RecursionType.Full), VersionSpec.Latest);
return workspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite);
}
catch
{
throw;
}
}
private Workspace SetupWorkSpace()
{
VersionControlServer sourceControl = SetupVersionControlRepositoryConnection();
Workspace workspace = sourceControl.QueryWorkspaces(
Environment.MachineName,
sourceControl.AuthorizedUser,
Environment.MachineName).SingleOrDefault();
if (workspace == null)
{
workspace = sourceControl.CreateWorkspace(Environment.MachineName, sourceControl.AuthenticatedUser, "newworkspace");
}
return workspace;
}
I made a change so now it shows...
private GetStatus DownloadLatestFiles()
{
Workspace workspace = null;
GetStatus status = null;
try
{
workspace = SetupWorkSpace();
List<Solution> services = _serviceList.GetAll();
foreach (Solution solution in services)
{
WorkingFolder workingFolder = new WorkingFolder(ConvertLocalToTfsPath(solution), GetSolutionFolder(solution));
workspace.CreateMapping(workingFolder);
//GetRequest request = new GetRequest(new ItemSpec(_repositoryCredentials.RepositoryProjectPath, RecursionType.Full), VersionSpec.Latest);
//status = workspace.Get(request, GetOptions.GetAll | GetOptions.Overwrite);
status = workspace.Get();
}
}
catch
{
throw;
}
return status;
}
Currently still downloads all files.