c# - How to connect to TeamFoundationServer (tfs) using client api from a console application? -


I hosted from TeamFoundationServer to connect with my Client API on Visualstudio.com The console application is trying, but I get this error:

TF400813: The resource is not available for anonymous access. Client

My code:

  Private static zero main (string [] ARG) {URI COLLECTION URU = NEW URI ("https: //MyName.visualstudio .com / DefaultCollection "); TfsTeamProjectCollection Collection = New TfsTeamProjectCollection (ArchiveURI, New System.Net.NetworkCredential (@ "MeMail@gmail.com", "MyPassword")); WorkItemStore workItemStore = collection.GetService & lt; WorkItemStore & gt; (); }  

You must call make sure the authorized () method From TfsTeamProjectCollection :

  Private static zero main (string [] args) {URI COLLECTION URI = NEW URI ("https://MyName.visualstudio.com/DefaultCollection" ); Network credential credentials = new network credentials ("USERNAME", "password"); TfsTeamProjectCollection TeamProjectCollection = New TfsTeamProjectCollection (Collections, Credentials); TeamProjectCollection.EnsureAuthenticated (); WorkItemStore workItemStore = teamProjectCollection.GetService & lt; WorkItemStore & gt; (); WorkItem Collection Workimmoculation = Workstormstore.settings ("Quarter here"); Vorach (various items in the Wirt item collection) {// do something here}}  

I hope your problem has been resolved.


Comments