views:

25

answers:

1

I am attempting to write a c# application that connects to TFS and retrieves work item information. Unfortunately, it seems like all examples of using the TFS SDK are using the default credentials for the current user (i.e. my domain login information). The closest piece of information I found is to use the TeamFoundationServer (String, ICredentials) constructor, however I cannot find any information for a suitable class that interfaces with the ICredentials interface (especially since it seems to not be using the System.Net ICredentials but a TeamFoundationServer specific ICredentials).

Does anyone have any insight for logging into TFS with a specific username/password/domain combination?

+1  A: 

The following code should help you:

NetworkCredential cred = new NetworkCredential("Username", "Password", "Domain");
tfs = new TeamFoundationServer("http://tfs:8080/tfs", cred);
tfs.EnsureAuthenticated();

Domain is either the actual domain, or in a Workgroup situation, it would be the name of the server that hosts the TFS Application Tier.

Robaticus
Awesome that worked! Thanks.
KallDrexx