How can i provide credentials to TfsTeamProjectCollectionFactory.GetTeamProjectCollection
?
I am trying to develop my own WCF Service from witch I will make the request to TFS
I need this WCF service because I would like to manage my TFS files from mobile in witch I cannot use Microsoft.TeamFoundation.* dll
I have been trying this way
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);
Second try using Custom class derived from ICredentialsProvider
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)
{
}
}
But it works only in my machine since I am logged in to tfs.