Wednesday, February 27, 2013

STEPS TO DELETE WORK ITEMS FROM TFS 2010 PERMANENTLY


STEPS TO DELETE WORK ITEMS FROM TFS 2010 PERMANENTLY

Work items cannot be deleted from graphical interface, but it’s possible in the command line, more precisely by witadmin utility. In Visual Studio Command Prompt, you can use witadmin directly, in PowerShell.

Step 1: Log-in to the TFS using a TFS administrator user.

Step 2: Open a command line and go to:
32bit machine - “X:\Program Files\Microsoft Visual Studio 10.0\Common 7\IDE”
64bit machine - “X:\Program Files (x86)\Microsoft Visual Studio 10.0\Common 7\IDE”

Step 3: Use the “witadmin.exe destroywi” command in the following way:
witadmin.exe destroywi /Collection:http:\\[ServerName]:8080\tfs\[CollectionName] /id:[WI ID]
You can add as many Work Item IDs as you like using [,] for example 54,88,92 etc.
You can disable the prompt message by using /noprompt.


You can delete a work item in this way:
#In general:
witadmin destroywi /collection:[project collection URL] /id:[work item ID]
#Concrete example:
witadmin destroywi /collection:mytfs\DefaultCollection /id:42

You can specify multiple work items delimited by comma:
witadmin destroywi /collection:mytfs\DefaultCollection /id:42,44

or – let’s say – delete items in a loop:
foreach ($id in 50..100)
{
    witadmin destroywi /collection:tfs.to-increase.com\AX /id:$id /noprompt
}

NOTE:
To be able to delete work items, you must be a member of Team Foundation Administrators or Project Administrators user group.
Once, the Work Item is deleted it cannot be recovered back.


No comments:

Post a Comment