Bulk destroy Work Items from Team Foundation Server

WARNING: Destroy work items is a irreversible action so use with caution and at your own risk!

Lately I am quire busy with all kinds of migration work to Team Foundation Server. This means a lot of testing, modifying and re-testing. Because the target Team Project has quite some modifications and custom work it is a lot of work to re-create the Team Project before every test run. That’s why I want to destroy work items within this Team Project so that I can start fresh every run (or after a few runs).

As you might or might not know you can easily destroy (that is really remove from TFS) work items with the witadmin destroywi command. You can also put mulitple id’s in this command and destroy multiple items in the same run.

The only problem is that the id’s must be comma separated and I hate typing. Also in my expereince, putting too many id’s at the same time freezes the system.

To facilitate my needs I created a small utility that lets me generate witadmin command in batches of 50 id’s and I wanted to share this simple utility with you all. I called it WorkItemDestroyer.

image

Work Item Destroyer

The idea is not to automate everything but to use best of all worlds. The steps you need to perform

  • Create a work item query that contains all the work items you want to destroy. Save the query and make sure the query contains the [ID] columnimage
  • Open the query in Excel by using the Team pluginimage
  • Copy the values in the [ID] columnimage
  • Start the Work Item Destroyer and paste the [ID] values is the [Source ID] Text box
  • Browse for the target Team Project Collection by pressing the [Browse TFS] button or just fill in the url
    image
  • Press [Generate] and [witadmin] commands are generated in the [Commands] text box. If you checked the [No Prompt] textbox the /noprompt will be generated meaning that you will not have to press Y to continue when you execute the command on the command line
  • Copy the contents of the [Command] textbox and paste into a Developer Command prompt. The commands will be executed directly!
  • [BEWARE] Destroy is irreversible so perform at your own risk !image

Hope this is useful for you !

You can download the source + executable here!

UPDATE: I added the source code to GitHub. Please feel free to contribute!

https://github.com/renevanosnabrugge/TFS-WorkItemDestroyer

 

Update 2015-04-08:

If you are looking for a script to bulk edit some work items, Kees Verhaar has a great post about how to do this in PowerShell. Read more on is blog. http://realalm.com/2015/04/08/bulk-update-tfs-work-items-using-powershell/

Advertisements

3 Responses to “Bulk destroy Work Items from Team Foundation Server”

  1. I have had to do similar things. Wish this existed then. Thanks for making it available!
    Rasky

  2. Just what I needed! Many thanks.

  3. Thanks, saved me a bunch of work!

%d bloggers like this: