If you work with Work Items in VSTS/Team Foundation Server then you’ve probably had the desire to delete a work item at some point. Sounds easy enough, right? Just right-click a work item and select… wait, there’s no Delete option? That’s right – the Team Foundation Client does not include any functionality for deleting work items from TFS.
Although it’s a tad inconvenient, you can delete work items from TFS by installing the Team Foundation Server Power Tools (October 2008 release or greater). Of the many features available as part of the power tools, there is a command called destroywi that can be used to delete work items. For example, to delete the work item ID 1234, use the command:
tfpt destroywi /server:tfs-dev /workitemid:1234
Although this is a relatively straightforward task to perform, not everyone is comfortable with the command line interface not to mention you have to look up the work item ID(s) ahead of time. To ease the process a little bit, I created a simple UI that sits on top of the Team Foundation Server Power Tools that allows you to easily select a Team Foundation Server and Project to query from. You can run an existing query to display a list of work items from which you can select one or more work items to be deleted. You can also enter the work item IDs directly (as a comma-separated list) if you prefer.
Here is a screen shot of the utility after running the All Work Items query for a Demo project:
When you select one or more work items to be deleted, click the Delete button. You will be prompted to be sure you want to delete since the action cannot be undone (i.e. it’s permanent).
DISCLAIMER: We have been using this utility in multiple production environments for several weeks now and have not experienced any issues. However, since this utility physically deletes work items from a Team Foundation Server (via the Team Foundation Server Power Tools), use at your own risk :-)
Download the Delete Work Item utility here.