title: How to connect to TeamFoundationServer (tfs) using client api from a console application?
body: <p>I'm trying to connect to <code>TeamFoundationServer</code> hosted at visualstudio.com using its client API with a Console Application, but I get this error:</p>
  
  <p><code>TF400813: Resource not available for anonymous access. Client</code></p>
  
  <p>My code:</p>
  
  <pre><code>private static void Main(string[] args)
  {
      Uri collectionUri = new Uri("https://MyName.visualstudio.com/DefaultCollection");
  
      TfsTeamProjectCollection collection =
          new TfsTeamProjectCollection(
              collectionUri,
              new System.Net.NetworkCredential(@"MeMail@gmail.com", "MyPassword"));
  
      WorkItemStore workItemStore = collection.GetService&lt;WorkItemStore&gt;(); 
  }
  </code></pre>