十年过去了,你这是怎么用TFS 2013 API做到这一点:
// Connect to TFS Work Item Store
ICredentials networkCredential = new NetworkCredential(tfsUsername, tfsPassword, domain);
Uri tfsUri = new Uri(@"http://my-server:8080/tfs/DefaultCollection");
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(tfsUri, networkCredential);
WorkItemStore witStore = new WorkItemStore(tfs);
如果不工作,尝试通过其他Credential
类的凭据(为我工作):
// Translate username and password to TFS Credentials
ICredentials networkCredential = new NetworkCredential(tfsUsername, tfsPassword, domain);
WindowsCredential windowsCredential = new WindowsCredential(networkCredential);
TfsClientCredentials tfsCredential = new TfsClientCredentials(windowsCredential, false);
// Connect to TFS Work Item Store
Uri tfsUri = new Uri(@"http://my-server:8080/tfs/DefaultCollection");
TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(tfsUri, tfsCredential);
WorkItemStore witStore = new WorkItemStore(tfs);
真棒工作!谢谢。 – KallDrexx 2010-06-30 15:51:29
请注意'TeamFoundationServer'已被弃用,以支持'TfsConfigurationServer',但是这个代码也适用于它。 – 2014-07-23 22:25:50