I'm using the TFS Client API to try and query a TFS 2010 instance. I need to be able to do the following
Then be able to iterate through this list and get some metadata for the items (file and folder names ideally)
I think I need to use the QueryXXX methods on the VersionControlServer class, but cannot find any helpful or clear examples on how to use this.
I have seen there is GetLastestChangesetId method, but this doesn't look like it can be scoped to a specific project or directory.
This is pretty straightforward:
var tfsUrl = "http://myTfsServer:8080/tfs/defaultcollection";
var sourceControlRootPath = "$/MyTeamProject";
var tfsConnection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tfsUrl));
var vcs = tfsConnection.GetService<VersionControlServer>();
var changeSets = vcs.QueryHistory(sourceControlRootPath, RecursionType.Full);
foreach (var c in changeSets)
{
var changeSet = vcs.GetChangeset(c.ChangesetId);
foreach (var change in changeSet.Changes)
{
// All sorts of juicy data in here
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With