How to find all Code Reviews across Projects and Collections in TFS?

15,522

Solution 1

Sadly I don't think there is a nice way to do what you are asking. Certainly not within Team Explorer. Code Reviews as you are aware get stored as work items and there is a strong boundary between Team Projects, which among other things, work items cannot cross. A note for the future, depending on how your business operates, you could consider 1 Team Project Collection, 1 Team Project and segregate your work by Teams and Areas. http://nakedalm.com/one-team-project/ this doesn't help you now of course.

I'm pretty sure that you will not be able to create a query using TFS to return the items you want (note, if you could, you would need to query for Work Item Response that are assigned to you Assigned To = @Me and not the Work Item Request. The request is the person making the code review request and the response is the reviewer(s).

Do you have tfs reports enabled? If so, as ds19 suggests, you could query the tfs_Warehouse db directly.

Another solution might be the TFS API but you will need TFS 2015 for that (which is packed full of features by the way) (Even though the link says it's for Visual Studio Online, it works for On-Prem too.)

I know this doesn't answer your question but hopefully it gives you some things to think about

Solution 2

On VS 2015, Go to Team Explorer Home > Click on Work Items ... > Select New Query > Select "Reviewed By" in the Field column and add the related username in the Value field and run the query. You will see all the Code reviews you have been a part.

Share:
15,522
Jeroen
Author by

Jeroen

Software developer, gamer, chef, and Stack Overflow fan from the Netherlands. Find me online in these places: 🌍 www.jeroenheijmans.nl 🐦 Twitter (@jeroenheijmans) 💼 LinkedIn 🍕 Meetup

Updated on June 26, 2022

Comments

  • Jeroen
    Jeroen almost 2 years

    We have 4 Team Project Collections with a dozen-or-so Team Projects each. We've started using the integrated Code Review system, and request reviews across those Collections and Projects.

    Is there an easy way to find all Code Reviews you're involved in, across Collections or at least across Projects in a Collection? I'd prefer a way to do it in the Team Explorer inside Visual Studio, but have access to the web portal as well. I'd already be happy if I could search within a Collection, if it's not possible to do it across them.

    I've carefully review the "My Work" section of the Team Explorer, and also closed the sln to try to force the context of the Explorer to the entire Collection. No dice: the "My Work" header still shows the actual Project in a dropdown.

    I've tried to create a custom "Query", but am not sure how to proceed. The query that is generated has a clause to filter on Team Project = @Project, but I deleted that leaving me with basically this query:

    Work Item Type = Code Review Request
    

    I've left out State <> Closed for testing purposes, and I'd create a seperate query (I think) for work item type Code Review Response, but before I go there: the above query seems to give only reviews for the currently selected Team Project. Additionally, upon saving it, I get presented with a dialog that wants me to save the query inside a specific Project, further suggesting that it's still project-specific.

    I'm using TFS 2013 but we tend to upgrade whenever it's useful so if there's upcoming features in newer version that solve this I'd be happy to hear about them.

    Bottom line: how to get an overview of all your Code Reviews on your TFS server?

  • Jeroen
    Jeroen over 8 years
    How does one "query the Tfs_Warehouse"? I'm a developer using TFS, not quite a TFS-administrator. The Open Query screens (from Team Explorer > My Work > Code Reviews) is a visual GUI for creating queries.
  • Rodders
    Rodders over 8 years
    He means the mssql database, Tfs_Warehouse, this is assuming that you have the data warehouse enabled
  • Jeroen
    Jeroen over 8 years
    On the contrary (to your final remark), this answers my question just fine. Thank you for your insight, and confirming my suspicion that this isn't easily possible. Just looks like we have too many Collections / Projects for our actual use case.
  • Rodders
    Rodders over 8 years
    It's not necessarily a bad thing. The problem is that often it is assumed that a Team Project = Product which is not necessarily the case! Glad that I could be of help