tags:

views:

104

answers:

1

Hi,

I'm having trouble authenticating as a specific user on MS Team Foundation Server. In older versions it would look like:

teamFoundationCredential = new System.Net.NetworkCredential("<USERNAME>", "<PASSWORD>", "<DOMAIN>");

TeamFoundationServer tfs = new TeamFoundationServer("http://mars:8080/", teamFoundationCredential);

Can some one tell me the equivilent for the 2010 version. So far I have:

ICredentialsProvider cred = null;

tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri("http://asebeast.cpsc.ucalgar.ca:8080/tfs/DefualtCollection"));

tfs.EnsureAuthenticated();

Thanks

+1  A: 

Here's how you do it in TFS 2010:

TfsTeamProjectCollection collection = new TfsTeamProjectCollection(
        new Uri(http://asebeast.cpsc.ucalgar.ca:8080/tfs/DefualtCollection,
        new System.Net.NetworkCredential("domain_name\\user_name", "pwd"));
collection.EnsureAuthenticated();
DmytroL