How to delete Work Item from Team Foundation Server

戏子无情 提交于 2019-12-02 18:52:54
Fernando

See this tool: http://devmatter.blogspot.com/2009/04/deleting-work-items-in-tfs-ui.html

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

The answers here are obsolete for TFS 2010. You need to use the 'witadmin destroywi' command now.

http://msdn.microsoft.com/en-us/library/dd236908.aspx

No one added code or an example, so here is my re-iteration of this answer using Rob Cannon's answer as guidance above.

This is batch file code for accomplishing this task. You will be prompted before you actually delete your Work Item.

ECHO OFF

SET "VSDir=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\"

CD %VSDir%

SET /p WorkItemID=Enter Work Item ID: 

ECHO.

witadmin destroywi /collection:{TFS Server}/{Collection Name} /id:%WorkItemID%

ECHO.
PAUSE

Enjoy

Sam

If you want to do this without using the tool suggested in the accepted answer, here is a quick summary of what to do. This is based on the corresponding MSDN article suggested in another answer.

Open Visual Studio Command Prompt:

Using the start menu:

  • Search for it.
  • Or navigate to All Programs -> Microsoft Visual Studio X -> Visual Studio Tools to find it.

Invoke witadmin

  1. Determine the team project collection URL. An example is http://ServerName:Port/VirtualDirectoryName/CollectionName.
  2. Determine the work item id.
  3. Invoke the following command, substituting the two above values:

    witadmin destroywi /collection:CollectionURL /id:id
    

See the MSDN article for more details. Note that you need permission for this to work.

Daniel

You have to use the TFS Power Tools.

http://msdn.microsoft.com/en-us/vstudio/bb980963.aspx

1) As mentioned above the destroy command (pretty tiresome if you have to delete more than a single item)

2) With TFS 2015.2 you get a new recycle bin function (without an option to permanently remove the items).

https://www.visualstudio.com/en-us/news/tfs2015-update2-vs.aspx#delwork

But since they dont appear anywhere (replaces the "Removed" State) and they can be restored ... compared to the fact that it took since 2008 to add the bin feature .. pretty neat id say :D

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!