使用TFS API,我怎么能找到它是在code审查提出的意见? [英] Using TFS API, how can I find the comments which were made on a Code Review?

查看:242
本文介绍了使用TFS API,我怎么能找到它是在code审查提出的意见?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图想出一个办法来查找有关code审查请求/响应在TFS2012项目的详细信息。

I'm trying to figure out a way to find details about a Code Review Request / Response item in TFS2012.

我可以查询以下面的方式全部code审查请求/响应项目:

I can query for all Code Review Request/Response items in the following way:

const string TfsUri = "http://mytfsserver:8080/tfs/Default ProjectCollection";

var tfs = new TfsTeamProjectCollection(new Uri(TfsUri));
var store = tfs.GetService<WorkItemStore>();

var versionStore = tfs.GetService<Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer>();

var queryText = "SELECT [System.Id], 
                 FROM WorkItems 
                 WHERE [System.WorkItemType] = 'Code Review Request' 
                 or [System.WorkItemType] = 'Code Review Response'";
var query = new Query(store, queryText);

var result = query.RunQuery().OfType<WorkItem>();

这给了我工作项类型的列表。当我遍历所有的 result.FirstOrDefault()。字段属性,它确实给了我这是关系到code查看关于搁置了一些有用的信息,在相关语境。利用这些信息,我可以查询搁置:

This gives me a list of WorkItem types. When I loop over the result.FirstOrDefault().Fields property, it does give me some usefull information about the ShelveSet which is related to the Code Review, the "Associated Context". Using this information, I can query for the ShelveSet:

var versionStore = tfs.GetService<VersionControlServer>();
var shelveset = versionStore.QueryShelvesets("someCodeReviewId_xxxx","someUserName");

这给了我一个搁置项目,但是这就是我会被卡住。

this gives me a ShelveSet item, but that's where I get stuck.

我进去看了 Microsoft.TeamFoundation。codeReview 双方 Microsoft.TeamFoundation。codeReview.Components提供空间 Microsoft.TeamFoundation。codeReview.Controls 库,但是这并不能帮助我进一步无论是。

I've looked into the Microsoft.TeamFoundation.CodeReview namespace provided by both Microsoft.TeamFoundation.CodeReview.Components and Microsoft.TeamFoundation.CodeReview.Controls libraries, but this doesn't help me further either.

我的问题是:我如何才能找到一个code审查期间搁置取得实际的意见(包括一般性意见和文件的意见)通过TFS API

My question is: How can I find the actual comments made on a ShelveSet during a Code Review (both General comments and File comments) through the TFS API?

推荐答案

我没有code的例子,但根据<一个href=\"http://social.msdn.microsoft.com/Forums/en-US/tfsgeneral/thread/3bc5ad0e-2bc6-4e1f-bdfa-6b649d453e7a/\">this讨论,你应该能够得到code审查意见与在<一个功能href=\"http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.discussion.client.aspx\">Microsoft.TeamFoundation.Discussion.Client命名空间。

I don't have code examples, but according to this discussion, you should be able to get to code review comments with functionality in the Microsoft.TeamFoundation.Discussion.Client namespace.

具体意见都可以通过<一个访问href=\"http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.discussion.client.discussionthread.aspx\">DiscussionThread类。你应该能够使用查询讨论<一个href=\"http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.discussion.client.idiscussionmanager.aspx\">IDiscussionManager.

Specifically the comments are accessible via the DiscussionThread class. And you should be able to query discussions using IDiscussionManager.

这篇关于使用TFS API,我怎么能找到它是在code审查提出的意见?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆