我正在尝试在 c# 中创建一个程序,该程序允许我连接到我的 TFS 以创建新的工作项。
NetworkCredential netCred = new NetworkCredential(
"username",
"password");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("https://example.visualstudio.com/DefaultCollection"),tfsCred);
tpc.Authenticate();
当我尝试连接到 TFS 时,我使用的是我自己的 Live 用户名和密码,这给了我错误消息“TF30063:您未被授权”。我不确定连接到 TFS 的不同方法。
我相信正确的方法是使用服务凭证,但目前我无法练习如何找出服务凭证,只是我不确定如何在 TFS 中找出我的服务凭证。
最佳答案
您需要enable alternate credentials使用 TFS API 连接到 Visual Studio Online 时。
关于api - 以编程方式连接到 TFS 出现 "TF30063: You are not authorized"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21911685/