title: Connecting to TFSPreview Programmatically
body: <p>I'm attempting to connect to <a href="http://tfspreview.com/" rel="nofollow">TFS Preview</a> from a C# application.</p>
  
  <p>At the moment, I'm stuck trying to authenticate.  I've added a reference to the TFS 2010 DLLs (I believe that these will enable me to connect, please correct me if I am wrong!) and my test case is as simple as.  The URL I am trying to connect to is in the form <code>https://MYSERVERNAME.tfspreview.com/DefaultCollection</code></p>
  
  <pre><code>var teamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(workPath, new UICredentialsProvider());
  teamProjectCollection.EnsureAuthenticated();
  </code></pre>
  
  <p>This fails with the following exception.</p>
  
  <blockquote>
    <p>Team Foundation services are not available from server <a href="https://MYSERVER.tfspreview.com/" rel="nofollow">https://MYSERVER.tfspreview.com/</a>$/defaultcollection.
    Technical information (for administrator):
      TF400813: Resource not available for anonymous access. Client authentication required.</p>
  </blockquote>
  
  <p>I had hoped that providing a <code>UICredentialsProvider</code> in the factory method creating the team project collection that it'd use this to provide authentication.  The TFS Preview service uses Windows Live authentication, but I had hoped that this would be covered.</p>
  
  <p>Pointers in the right direction greatly appreciated!</p>