9

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

dbc
  • 104,963
  • 20
  • 228
  • 340
gabrielmaldi
  • 2,157
  • 2
  • 23
  • 39

1 Answers1

12

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);
granth
  • 8,919
  • 1
  • 43
  • 60