How to delete Work Item from Team Foundation Server

时光毁灭记忆、已成空白 提交于 2019-12-03 06:23:01

问题


Is there a chance to delete Work Item from TFS, or all I can do is just to rename it.

Update: This question was for TFS 2008. New version (2010) have out of the box solution as Rob Cannon suggested


回答1:


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




回答2:


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




回答3:


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




回答4:


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.




回答5:


You have to use the TFS Power Tools.

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




回答6:


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



来源:https://stackoverflow.com/questions/638154/how-to-delete-work-item-from-team-foundation-server

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