Created
January 7, 2014 12:03
-
-
Save richorama/8298356 to your computer and use it in GitHub Desktop.
Download files from Visual Studio Online
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var netCred = new NetworkCredential("username", "password"); | |
var basicCred = new BasicAuthCredential(netCred); | |
var tfsCred = new TfsClientCredentials(basicCred); | |
tfsCred.AllowInteractive = false; | |
var tfs = new TfsTeamProjectCollection(new Uri("https://XXX.visualstudio.com/DefaultCollection/"), tfsCred); | |
tfs.Authenticate(); | |
var vcs = tfs.GetService<VersionControlServer>(); | |
var items = vcs.GetItems(@"$\", RecursionType.Full); | |
foreach (var item in items.Items) | |
{ | |
Console.WriteLine(item.ServerItem); | |
if (item.ItemType == ItemType.File) | |
{ | |
item.DownloadFile(item.ServerItem.Split('/').Last()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment