Поделиться через


Delete a Work Item Field from a Team Project Collection

You can delete a work item type field from an existing team project collection by using the witadmin command-line tool. If you are currently using a field that you want to delete, you must first remove the field from the work item types.

In this topic

  • List Fields That Are Not Being Used

  • Verify a Field is Not in Use

  • Delete a Field From a Team Project Collection

Required Permissions

To perform this procedure, you must be a member of the Team Foundation Administrators group. For more information, see Team Foundation Server Permissions.

List Fields That Are Not Being Used

To list fields that are not being used by any work item type

  1. Open a Command Prompt window.

  2. Change to the directory that contains the work item types that you want to list, by typing the following command and then pressing Enter.

    cd ..Drive:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE

  3. List the fields that are no longer being used by any work item types by typing the following command at the command prompt, and then pressing Enter.

    witadmin listfields /collection:http://ServerName:Port/VirtualDirectoryName/CollectionName /unused
    

    Field and attribute information appears for each field that is not being used, as follows in this example.

    Field: Microsoft.VSTS.CMMI.TaskType
    Name: Task Type
    Type: String
    Reportable As: dimension
    Use: Not In Use
    Indexed: False
    
    Field: Microsoft.VSTSUE.Common.Flag
    Name: Flag
    Type: String
    Reportable As: dimension
    Use: Not In Use
    Indexed: False
    
    Field: Microsoft.VSTSUE.Common.Progress
    Name: Progress
    Type: String
    Reportable As: dimension
    Use: Not In Use
    Indexed: False
    

Verify a Field Is Not in Use

To verify that a field is not being used by any work item type

  1. Open a Command Prompt window.

  2. Change to the directory that contains the work item types, by typing the following command and then pressing Enter.

    cd ..Drive:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE

  3. Verify that a field is no longer being used by any work item types by typing the following at the command prompt, and then pressing Enter.

    witadmin listfields /collection:http://ServerName:Port/VirtualDirectoryName/CollectionName /n:FieldName
    

    In the information displayed for the field, verify that the value for Use is "Not In Use" as follows in this example.

    Field: MyCompany.MyProcess.MyField
    Name: MyField
    Type: String
    Reportable As: dimension
    Use: Not In Use
    Indexed: False
    
  4. If the Use field indicates that the field is in use, then you must delete it from each work item type for each team project that is listed. For example, the Microsoft.VSTS.TCM.SystemInfo field indicates that it is being used by the Bug and Code Defect work item types for four projects: Arroyo, Desert, Palm, and Springs.

    Field: Microsoft.VSTS.TCM.SystemInfo
    Name: System Info
    Type: Html
    Reportable As: None
    Use: Arroyo (Bug), Desert (Bug), Palm (Bug), Springs (Bug, Code Defect)
    Indexed: False
    

    Before you can delete this field, you must remove it from each of the work item types listed for each team project for which it is defined. For more information, see Add a Field to or Remove a Field from a Work Item Type.

Delete a Field From a Team Project Collection

To delete a field from the team project collection

  • Type the following command at the command prompt, and then press Enter.

    witadmin deletefield /collection:http://ServerName:Port/VirtualDirectoryName/CollectionName /n:FieldName
    

    Enter y at the confirmation prompt to complete this step.

See Also

Tasks

Add a Field to or Remove a Field from a Work Item Type

Reference

Customizing and Managing Work Item Types [witadmin]

Managing Work Item Fields [witadmin]