using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using System.Threading.Tasks;using Microsoft.TeamFoundation.Client; using Microsoft.TeamFoundation.VersionControl.Client; namespace TfsChangesetCommentEnricher { class Program { static void Main(string[] args) { var collection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection( new Uri("https://jessehouwing:8080/tfs/defaultcollection")); var vcs = collection.GetService<VersionControlServer>(); var changes = vcs.QueryHistory(new ItemSpec("$/", RecursionType.Full)); foreach (var change in changes) { if (!change.Comment?.Contains("rnrn-- rnOriginally checked-in") ?? true) { change.Comment = string.Format( CultureInfo.InvariantCulture, @"{0} -- Originally checked-in * by: {1} ({2}) * on: {3:u} * in: {5} * id: {4}", change.Comment, change.Committer, change.CommitterDisplayName, change.CreationDate, change.ChangesetId, change.VersionControlServer.TeamProjectCollection.Uri); change.Update(); } } } } }

Jesse Houwing
Jesse is a passionate trainer and coach, helping teams improve their productivity and quality all while trying to keep work fun. He is a Professional Scrum Trainer (PST) through Scrum.org, Microsoft Certified Trainer and GitHub Accredited Trainer. Jesse regularly blogs and you'll find him on StackOverflow, he has received the Microsoft Community Contributor Award three years in a row and has been awarded the Microsoft Most Valuable Professional award since 2015. He loves espresso and dark chocolate, travels a lot and takes photos everywhere he goes.
Contact