I need to export the comments made on code reviews along with information about the associated change. The file format is not that important, just need to get the data out of Azure DevOps.
Thanks!
I need to export the comments made on code reviews along with information about the associated change. The file format is not that important, just need to get the data out of Azure DevOps.
Thanks!
As far as I know ,there is no tools or extensions available to export code reviewer comments. Some users have already submitted a uservoice before, you could vote this and Microsoft engineers will evaluate it seriously. https://visualstudio.uservoice.com/forums/121579-visual-studio
Other contributors provided a workaround to resolve this issue, you can try to extract the data by using the TFS client object model and put them in Excel using a custom VSTO plugin for Excel or using a package like Excel Package Plus or Aspose Cells to generate the Excel file.
For details, you can refer to this thread: Using TFS API, how can I find the comments which were made on a Code Review?
public List<CodeReviewComment> GetCodeReviewComments(int workItemId)
{
List<CodeReviewComment> comments = new List<CodeReviewComment>();
Uri uri = new Uri(URL_TO_TFS_COLLECTION);
TeamFoundationDiscussionService service = new TeamFoundationDiscussionService();
service.Initialize(new Microsoft.TeamFoundation.Client.TfsTeamProjectCollection(uri));
IDiscussionManager discussionManager = service.CreateDiscussionManager();
IAsyncResult result = discussionManager.BeginQueryByCodeReviewRequest(workItemId, QueryStoreOptions.ServerAndLocal, new AsyncCallback(CallCompletedCallback), null);
var output = discussionManager.EndQueryByCodeReviewRequest(result);
foreach (DiscussionThread thread in output)
{
if (thread.RootComment != null)
{
CodeReviewComment comment = new CodeReviewComment();
comment.Author = thread.RootComment.Author.DisplayName;
comment.Comment = thread.RootComment.Content;
comment.PublishDate = thread.RootComment.PublishedDate.ToShortDateString();
comment.ItemName = thread.ItemPath;
comments.Add(comment);
}
}
return comments;
}
static void CallCompletedCallback(IAsyncResult result)
{
// Handle error conditions here
}
public class CodeReviewComment
{
public string Author { get; set; }
public string Comment { get; set; }
public string PublishDate { get; set; }
public string ItemName { get; set; }
}