我正在尝试从TFS审核我的所有代码评论的评论评论。 我无法构建查询。我的参数如下。我从中得不到任何结果: - (
Team Project = @Project
And Work Item Type In Group Code Review Response Category
And Requested By = @Me
Or Requested By Was Ever @Me
由于
答案 0 :(得分:0)
工作项查询无法检索代码审核注释,您可以使用TFS API实现目标。 This case提供了解决方案,您可以查看它:
您应该可以使用Microsoft.TeamFoundation.Discussion.Client命名空间中的功能获取代码审核注释。
具体而言,可以通过DiscussionThread课程查看评论。您应该能够使用IDiscussionManager查询讨论。
代码段如下:
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; }
}