According to the MSDN the method GetTeamProjectCollection(RegisteredProjectCollection projectCollection, ICredentialsProvider fallbackCredentialsProvider
of the TfsTeamProjectCollectionFactory
class is now deprecated:
"Note: This API is now obsolete."
[ObsoleteAttribute("This method has been deprecated and will be removed in a future release. See GetTeamProjectCollection(RegisteredProjectCollection) instead.", false)]
The advice is to use the overload that only takes the RegisteredProjectCollection
, but what should we use from now on if we want a fallback mechanism for credentials?
Thanks
You need to use the new TfsTeamProjectCollection constructor along with this TfsClientCredentials constructor which allows interactive prompts for authentication.
// Use default windows credentials, and if they fail, AllowInteractive=true
var tfsCreds = new TfsClientCredentials(new WindowsCredential(), true);
TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(
new Uri("http://yourserver:8080/tfs/DefaultCollection"),
tfsCreds);