十年過去了,你這是怎麼用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