1

我正在尝试连接到我们的在线 TFS。这是我目前拥有的:

NetworkCredential cred = new NetworkCredential(textBox_Username.Text, 
    textBox_password.Password);
Uri TFSurl = new Uri("https://myCompany.visualstudio.com/DefaultCollection");
TfsConfigurationServer tfs = new TfsConfigurationServer(TFSurl, cred);
tfs.EnsureAuthenticated();

这让我:

TF30063:您无权访问https://actacom.visualstudio.com/DefaultCollection

输入的凭据是正确的。

4

2 回答 2

1

检查这个博客文章,它有一个关于如何做的示例代码。我已经用我的 VSO 帐户尝试过,效果很好。

于 2014-08-04T18:41:31.517 回答
0

博客帮助了我。对于其他人,这是工作代码。

 NetworkCredential netCred = new NetworkCredential(
                textBox_Username.Text,
                textBox_password.Password);
                BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
                TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
                tfsCred.AllowInteractive = false;

                TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
                    new Uri("https://fabrikam.visualstudio.com/DefaultCollection"),
                    tfsCred);

                tpc.Authenticate();
于 2014-08-04T18:48:33.680 回答