How to get check / change history for a specific team project?

I use the TFS client API to try and request an instance of TFS 2010. I need to do the following

  • For a specific team project, say, Project A
  • Get a list of the history of the last checks made in this project (for example, the last 50 or the list for the last day).

You can then iterate over this list and get some metadata for the items (file and folder names ideally)

I think I need to use the QueryXXX methods in the VersionControlServer class, but I cannot find useful or clear examples of how to use this.

I saw that there is a GetLastestChangesetId method, but it does not look like it can be attached to a specific project or directory.

+6
source share
1 answer

It is pretty simple:

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 } } 
+13
source

Source: https://habr.com/ru/post/971538/


All Articles