Saturday, July 3, 2010

TFS 2010 API: Connecting to a TFS collection using a specific user

Just a quick code snippet to describe how to authenticate with a specific user to a TFS collection:

   1:  TfsTeamProjectCollection collection = new TfsTeamProjectCollection( 
   2:          new Uri(http://tfs:8080/tfs/DefaultCollection, 
   3:          new System.Net.NetworkCredential(@"domain_name\username", "password")); 
   5:  collection.EnsureAuthenticated(); 

No comments: