api - 以编程方式连接到 TFS 出现 "TF30063: You are not authorized"错误

标签 api service tfs credentials networkcredentials

我正在尝试在 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/

相关文章:

tfs - 是否有一种标准方法可以在完成后立即删除成功的 vnext 构建(PR)?

python - 使用Python API访问交易平台

javascript - 如何使用for循环在div中显示restful api获取的数据?

Javascript:根据键的值有条件地过滤 JSON?

android - BroadcastReceiver 在两个服务之间不起作用

android - 如何将回调放入 Intent 中?

TFS 托管构建 Controller - 未找到 Microsoft.TextTemplate.targets

javascript - 捆绑 API 请求

wcf - 使用 WCF 的 basicHttpBinding 进行 Windows 身份验证

git - 切换分支不会刷新 Visual Studio 中的解决方案资源管理器