13

I made some changes and then requested Code Review in TFS, then realized I had made the changes to the wrong branch. So I tried to delete the work item to show that I no longer needed code review (at least in this branch). However, when I tried to do that, I got the beautiful red error:

Failed to delete work item: 1061. Error Details: VS402838: The work item 1061 cannot be deleted. Code Review Request work items cannot be deleted.

For now, I'll just have everybody complete the code review where it sits, and then I'll make the exact same changes in the correct branch. But I'm wondering what you are supposed to do in this case if they insist you can't delete Code Review Request work items.

NH.
  • 2,240
  • 2
  • 23
  • 37

3 Answers3

20

This can be accomplished by creating a query that includes the desired work item, then editing it from within the query.


  1. Create a new query, then specify criteria such as Created By (yourself) that will find the work item. ID doesn't work so well if the work item was already assigned out, as each reviewer has their own work item.
  2. Right-Click the work item you want to edit.
  3. Select edit from the context menu.

Steps 1-3:

Steps 1-3 in image form

  1. In the window that comes up, enter "State" for Field and "Closed" for Value: State: Closed
  2. Enter some notes about the manual change and then close the dialog with the "OK" button, and then don't forget to save your changes with this button:

enter image description here

NH.
  • 2,240
  • 2
  • 23
  • 37
  • is not possible, here is the alert it shows "Error saving work items Failed to save the following 1 work item(s). Work item 22: The field 'State' contains the value 'Closed' that is not in the list of supported values. Please correct the unsaved work item(s) and try again. " – Carlos.V Mar 14 '19 at 23:41
  • @Carlos.V Use whatever value your TFS install has. – NH. Mar 15 '19 at 16:52
  • 2
    In addition to setting State to Closed, you'll probably need to provide a value for Closed Status. I used Removed. – DJ Grossman Oct 30 '20 at 17:57
  • @NH. No - this is something that was not noted in any of the steps. I was unable to Save until I also provided a value for Closed Status, which is not the same as State. – DJ Grossman Nov 02 '20 at 14:54
4

I think The Right Thing to do in TFS-land is to Abandon the Code Review, since you can't delete it from TFS.

The previous answers have two means of doing that. Here's a third, from within Visual Studio, since that seemed like a convenient alternative.


  1. Open My Work in the Team Explorer window.

my work link in the Team Explorer interface

  1. Find the Code Reviews section of My Work.

my work section of Team Explorer

  1. Right-click the Code Review you want to Abandon.

  2. Select Open.

  3. In the Code Review UI, select Close Review for the reason Abandon

Code Review UI with Close Review highlighted

  1. Profit.
ruffin
  • 16,507
  • 9
  • 88
  • 138
1

You can cancel a code review required by using excel

Please try this workaround: create a work query to get all that user’s Code Review Request work items which in Requested state, save this work item query and open this query in Excel, then edit them work items in Excel to change the state to Closed, then click Publish button to publish the updates to TFS Server.

See this URL https://social.msdn.microsoft.com/Forums/vstudio/en-US/83d96317-cdd7-436c-8415-fda54d1ce752/cancel-a-code-review-request?forum=tfsworkitemtracking

Tony Dong
  • 3,213
  • 1
  • 29
  • 32
  • 1
    That method is a little outdated, but I'll still upvote as it led me to [the correct answer](https://stackoverflow.com/a/49159512/1739000), despite having to click through a couple links. – NH. Mar 07 '18 at 19:08