13 April 2009

Deleting Work Items in TFS – a UI

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:

image

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.

27 comments:

Anonymous said...

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

kaps said...

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

Anonymous said...

Lifesaver.

Thanks!

Anonymous said...

Nicely done and thank you!!!

Jerence said...
This comment has been removed by the author.
Rob Burke said...

This saved a bunch of time today, and I wanted to stop by and say thank you!

Anonymous said...

It worked like a charm. This is a real life saver, thank you!!

Anonymous said...

SWEEEEEET!

Anonymous said...

Mind posting up the source? There are a few tweaks to the UI which would be nice

Anonymous said...

what tweaks are you talking about?

Unknown said...

Jeff,

Thanks. My reports (like Remaining Work) still shows the old count of work items.

-BSS

Anonymous said...

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...

Anonymous said...

This would be awesome but we have TFS 2010 so we eagerly await the version compatible with TFS 2010. Thanks!

Anonymous said...

What's the ETA for the TFS2010 version?

Anonymous said...

What's the ETA for the TFS2010 version?

Patrick Magee said...

I updated the tool myself. Here is the link http://blogs.isynch-d.com/default.aspx

Patrick Magee said...

Sorry I should have made that a proper link: DeleteWI TFS2010

I hope JeffB doesn't mind!

C-Mac said...
This comment has been removed by the author.
jarana said...
This comment has been removed by the author.
jarana said...

I get FileNotFoundException...

Leonardo Alberto Moreira said...

Great job man... I've updated the tool, added some simple features... a think you should keep increasing the tool.

Anonymous said...

It does not delete bug workitem.

MB said...

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.

Anonymous said...

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

ezien said...

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

Anonymous said...

Thank you so much for this!!! Works great with TFS 2008!

Unknown said...

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.

Post a Comment