C# .net tfs workspace operations

Viewed 335

I am trying to programmatically access tfs operations, primarily concerned with viewing, creating, modifying and removing workspaces, but also doing a get on source code. My research led me to the TeamFoundationServer.ExtendedClient nuget packages. I coded up this example:

TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(
    new Uri(TfsUrl),
    new VssBasicCredential(UserName, Password));                

tfs.EnsureAuthenticated();

VersionControlServer vcs = tfs.GetService<VersionControlServer>();
    
var workspaces = vcs.QueryWorkspaces(null, @"john.doe", null);

Which actually works fine, but my research also indicates that this is the .net 'legacy' way of doing it and i should be doing the more modern way as indicated here: MS DevOps

Unfortunately, all the examples i can find are accessing git, which i'm not using. The connection is templated out, and i can't find documentation of classes that implement the VssHttpClientBase base class. Can anyone point me to examples, or documentation that i'm missing?

1 Answers
Related