Functionality for deleting work items in Team Foundation Server is quite successfully hidden, so many people have no idea that it is possible. (That might be even good. ;)).
TFS2010
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, you can for example make an alias.
(I have the following command in my PowerShell profile: Set-Alias -Name witadmin -Value 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\witadmin.exe'
)
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 }
To be able to delete work items, you must be a member of Team Foundation Administrators or Project Administrators user group.
TFS2008
In TFS2008 you have to resort to PowerTools and tfpt.exe destroywi
command, in other respects the situation is exactly the same. For example:
tfpt.exe destroywi /server:mytfs /workitemid:42
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: http://visualstudiogallery.msdn.microsoft.com/1397f185-7f49-49c8-ad80-e45fc9dbbfe9
Regards
ezien