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?
The following code should help you:
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.
For TFS 2015 & 2017, objects and methods mentioned have been (or are being) deprecated.
To connect to TFS using specific credentials:
Years down the line, this is how you do it with TFS 2013 API:
If that doesn't work, try to pass the credentials through other
Credential
classes (worked for me):