共用方式為


Remove work items permanently

You can permanently remove one or more work items from the Team Foundation database for a team project collection by using the witadmin destroywi command. Work items whose state is set to Closed remain in the database and can be reactivated. Permanently removed work items are removed from the database and cannot be restored nor reactivated.

Each work item represents an object that is stored in the Team Foundation database and that is assigned a unique identifier, which is referred to as a work item ID. Work item IDs are unique within a project collection.

To run the witadmin command-line tool, open a Command Prompt window where either Visual Studio or Team Explorer is installed and enter:

cd %programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE

On a 32-bit edition of Windows, replace %programfiles(x86)% with %programfiles%.

Requirements

Note

Even if you log on with administrative permissions, you must open an elevated Command Prompt window to perform this function on a server that is running Windows Server 2008. To open an elevated Command Prompt window, choose Start, open the shortcut menu for Command Prompt, and choose Run as Administrator. For more information, see the Microsoft Web site.

witadmin destroywi /collection:CollectionURL /id:id [/noprompt]

Parameters

Parameter

Description

/collection:CollectionURL

Specifies the URI of the team project collection. The format for the URI is the following: http://ServerName:Port/VirtualDirectoryName/CollectionName

If no virtual directory is used, then the format for the URI is the following:

http://ServerName:Port/CollectionName.

/id:id

The ID of a work item to destroy. To specify multiple work items, separate IDs using only commas, without whitespace.

/noprompt

Disables the prompt for confirmation.

/? or help

Displays help about the command in the Command Prompt window.

Examples

Permanently Remove Work Items From the Database

The following example deletes the work item 2003 from the database for Collection1 on the AdventureWorksServer server:

witadmin destroywi /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /id:2003

The following example deletes the work items with IDs, 12, 15, and 23 from the database for Collection1 on the AdventureWorksServer server:

witadmin destroywi /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /id:"12,15,23"

See Also

Other Resources

Resolve, close, or reactivate a work item [redirected]

witAdmin: Customize and manage objects for tracking work