I am trying to connect to my Visual Studio Online account, via web api. Following the steps here for here:
http://blogs.msdn.com/b/buckh/archive/2013/01/07/how-to-connect-to-tf-service-without-a-prompt-for-liveid-credentials.aspx
NetworkCredential netCred = new NetworkCredential(
"[email protected]",
"mypassword");
BasicAuthCredential basicCred = new BasicAuthCredential(netCred);
TfsClientCredentials tfsCred = new TfsClientCredentials(basicCred);
tfsCred.AllowInteractive = false;
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("https://myaccount.visualstudio.com/DefaultCollection"),
tfsCred);
tpc.EnsureAuthenticated();
Console.WriteLine(tpc.InstanceId);
However I get the following error message:
TF30063: You are not authorized to access .visualstudio.com
So, for this you can clear the TFS cache and reconnect the TFS. You can clear TFS's cache from following location, just change the user name as per your system. Once cache will delete, probably TFS will ask for credential to reconnect. You need to provide valid credentials and TFS will work.
After trying every coding option in the book, I turned to an alternative approach:
Logged out of Visual Studio Online from:
and it worked...:)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With