I want to get date of changeset. The TFS SDK has much reference. Which reference and class do I need?
One of the best resources I've found on the TFS API is this series of blog posts: http://blogs.microsoft.co.il/blogs/shair/archive/tags/TFS+API/default.aspx
In this case, there's nothing explicitly about getting changeset information (that I saw) but there are a couple of other source-control related posts. From there you'll see that you need to start by getting a VersionControlServer
instance, and the MSDN page for that class should get you the rest of the way: call GetChangeset
to get a particular Changeset
object, which in turn has a CreationDate
property.
(If you don't actually know the changeset number you want, you can use methods like QueryHistory
to get changeset lists for particular paths in the source control database.)
var collectionUrl = "http://tfsserver:8080/tfs/DefaultCollection";
var tpc = new TfsTeamProjectCollection(collectionUrl);
var vc = tpc.GetService<VersionControlServer>();
// Get changeset #1234
var cs = vc.GetChangeset(1234);
// Get the last changeset checked into TFS by anyone.
var cslatest = vs.GetChangeSet(vs.GetLatestChangesetId());
// Get a list of all changesets for the $/MyProject/Main branch
var cslist = vc.QueryHistory("$/MyProject/Main", null, 0, RecursionType.Full,
null, null, int.MaxValue, false, false);