title: Connect to Visual Studio Team Services from WebService
body: <p>How can i provide credentials to <code>TfsTeamProjectCollectionFactory.GetTeamProjectCollection</code>?<br>
  I am trying to develop my own WCF Service from witch I will make the request to TFS<br>
  I need this WCF service because I would like to manage my TFS files from mobile in witch I cannot use Microsoft.TeamFoundation.* dll </p>
  
  <p>I have been trying this way</p>
  
  <pre><code>Uri tpcAddress= new Uri("https://myserver.visualstudio.com/DefaultCollection");
  TfsConnection tfsc = new TfsConfigurationServer(tpcAddress, 
          new NetworkCredential("mail@example.com", "password"));
  TfsWebClient wc = new TfsWebClient(tfsc);
  tfsc.Connect(ConnectOptions.IncludeServices);
  </code></pre>
  
  <p>Second try using Custom class derived from ICredentialsProvider</p>
  
  <pre><code>ICredentialsProvider prov = new myCredentials();
  var tpc = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tpcAddress, prov);
  tpc.EnsureAuthenticated();
  tpc.Authenticate();
  
  public class myCredentials : ICredentialsProvider
  {
      public ICredentials GetCredentials(Uri uri, ICredentials failedCredentials)
      {
          return new NetworkCredential("mail@example.com", "password");
      }
      public void NotifyCredentialsAuthenticated(Uri uri)
      {
      }
  }
  </code></pre>
  
  <p>But it works only in my machine since I am logged in to tfs.</p>