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.
Jeff,
Thanks a ton. This tool is really a life saver as it helped me restructure workitems rather than just living with junk. Hopefully the TFS team wakes up and just includes this feature in their product.
– A Microsoft user
Hi
The delete work item utility used to work , but now i am trying to delete a bug and its not deleting the bug thru this utility
Lifesaver.
Thanks!
Nicely done and thank you!!!
This comment has been removed by the author.
This saved a bunch of time today, and I wanted to stop by and say thank you!
It worked like a charm. This is a real life saver, thank you!!
SWEEEEEET!
Mind posting up the source? There are a few tweaks to the UI which would be nice
what tweaks are you talking about?
Jeff,
Thanks. My reports (like Remaining Work) still shows the old count of work items.
-BSS
Really? I mean you have to use the command from a free tool for a multi-thousand dollar product, to do a feature like delete? TFS its just not working out…
This would be awesome but we have TFS 2010 so we eagerly await the version compatible with TFS 2010. Thanks!
What’s the ETA for the TFS2010 version?
What’s the ETA for the TFS2010 version?
I updated the tool myself. Here is the link http://blogs.isynch-d.com/default.aspx
Sorry I should have made that a proper link: DeleteWI TFS2010
I hope JeffB doesn’t mind!
This comment has been removed by the author.
This comment has been removed by the author.
I get FileNotFoundException…
Great job man… I’ve updated the tool, added some simple features… a think you should keep increasing the tool.
It does not delete bug workitem.
I have tried your code for TFS 2010 but Form is not gettign displayed.
I am not able to get the UI after building the code.
I know this thread is old but i came across a tool that i thought i should share.
If you are still doing work item delete via command line here is a tool that worked for me.
http://witadminui.codeplex.com/
Thanks
Sid
For TFS 2010 there is a TFS Extension that allows Work items deletion from Visual Studio. Just select the work items you need to delete and in context menu select Delete work items.
This extension is published in Visual Studio Gallery:
TEK workitem
Regards
ezien
Thank you so much for this!!! Works great with TFS 2008!
Copy the following command in notepad and save it as a batch file (.bat extension)
Provice the work item ids that you wish to delete.
@echo off
start “” “C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\witadmin.exe” destroywi /noprompt /Collection:http:\\mstfs.target.com:8080\tfs\collection2 /id:63860,63861,63862″
pause
Double click on the batch file. It will delete all the work item ids that are specified.