user2545071
user2545071

Reputation: 1410

How to init VersionControlServer class?

I want to download file from TFS 2013. I found the VersionControlServer class: msdn

But how to initialize it?

 VersionControlServer vs;
 vs.DownloadFile(repositoryPath,localPath); // vs not initialized!

Thank you!

Upvotes: 1

Views: 1651

Answers (1)

user2545071
user2545071

Reputation: 1410

String repositoryPath = "$/MyColl1/Folder1/Folder2/TargetFile.txt";
    String localPathStored = Environment.CurrentDirectory + "/" + "TargetFile.txt";
    String uriSite = "http://tfs-server:8080/tfs/../../vN.0/....asmx";
    TfsTeamProjectCollection teamProjectCollection =TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(uriSite));

    VersionControlServer versionControlServer = teamProjectCollection.GetService<VersionControlServer>();
    versionControlServer.DownloadFile(repositoryPath, localPathStored);

Upvotes: 3

Related Questions