65.9K
CodeProject is changing. Read more.
Home

Team Foundation Server (TFS) Build Comments Finder

Feb 10, 2010

CPOL
viewsIcon

27120

This utility is used to find the comments entered by users in TFS while check in the code. This will give change set number with owner, date of check in, comments and check in notes.So this will used in finding all checkin comments from TFS for any project. //Create object of tfs...

This utility is used to find the comments entered by users in TFS while check in the code. This will give change set number with owner, date of check in, comments and check in notes. So this will used in finding all checkin comments from TFS for any project.
 //Create object of tfs
 //Need to add server address, user ID, password and domain Name
 TeamFoundationServer tfs = new TeamFoundationServer("<ServerAddress>",
    new NetworkCredential("<UserID>","<Password>", "<DomainName>"));
 // Get a reference to Version Control.                       
 Type type = typeof(VersionControlServer);
 VersionControlServer versionControl = (VersionControlServer)tfs.GetService(type);
 //Need to add application path
 IEnumerable changeSets = versionControl.QueryHistory(@"<ApplicationPath>",
     VersionSpec.Latest, 0, RecursionType.Full, 
     null, null, null, 5000, true, false);           
                      
 int i =-1;
 foreach(Changeset data in changeSets)
 { 
     i++;
     this.dgvComment.Rows.Add();
     this.dgvComment.Rows[i].Cells["ChangeSetNo"].Value = data.ChangesetId.ToString();
     this.dgvComment.Rows[i].Cells["Owner"].Value = data.Owner; 
     this.dgvComment.Rows[i].Cells["Date"].Value = data.CreationDate.Date;
     this.dgvComment.Rows[i].Cells["Comments"].Value = data.Comment;
     this.dgvComment.Rows[i].Cells["CheckinNote"].Value = data.CheckinNote;              
 }