TFS & Visual Studio ALM – by Neno Loje

(formerly Team System, VSTS)

Q: How can I use an TfsTeamProjectCollection to authenticate against the REST API (*HttpClient)?

February 22nd, 2016 · No Comments · TFS Extensibility

Answer: If you are already authenticated against the “classic” TFS Object Model from the Microsoft.TeamFoundationServer.ExtendedClient NuGet Package  (typically having an instance of TfsTeamProjectCollection), you can use its GetClient<T> generic method to aquire an *HttpClient class from the REST API.

Example:

TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(collectionUri)))

TfvcHttpClient tfvcClient = tpc.GetClient<TfvcHttpClient>();

See also “Example 3” at: https://www.visualstudio.com/en-us/integrate/get-started/client-libraries/samples

–Neno

Tags:

No Comments so far ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment