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


Rename a Work Item Type Field

You can change the friendly name of a work item field to meet the naming conventions that your team uses by using the witadmin changefield command-line tool. Note that the new name is applied to all work item types that reference the changed field in all team projects in the project collection. The friendly name displays when you define filter criteria in a work item query. The name that appears on a work item form may be different than the friendly name defined for the field.

To view a list of fields defined for a project collection, see List Work Item Fields and View Attributes Assigned to Fields.

Required Permissions

To perform this procedure you must be a member of the Team Foundation Administrators group or a member of the Project Administrators group for all projects where the field is used. For more information, see Team Foundation Server Permissions.

In this topic

  • Rename the Friendly Name of a Work Item Field

  • Verify that Your Changes Appear in Team Explorer

Rename the Friendly Name of a Work Item Field

To rename a work item field

  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. To rename a work item field, type the following, and then press ENTER.

    witadmin changefield /collection:http://ServerName:Port/VirtualDirectoryName/CollectionName /n:typename /name:newname
    

    For example:

    witadmin changefield /collection:http://AdventureWorksServer:8080/AWTeam/Collection1 /n:Microsoft.VSTS.Common.Rank /name:"Important Rank"
    

    This command renames the Microsoft.VSTS.Common.Rank field to Important Rank.

  4. At the confirmation prompt type y and then press ENTER. Wait until you receive the following message:

    Field renamed.

    For more information, see Managing Work Item Fields [witadmin].

Verify that Your Changes Appear in Team Explorer

To verify changes imported to a single project

  1. In Team Explorer, right-click the node of the team project that contains a work item type that contains the renamed field, and click Refresh.

    The latest updates are downloaded from the server, which include the changes that you just made to the field name. Wait several seconds until the Work Items node is refreshed. Nodes that are still loading display the word working.

  2. Right-click the Work Items node, and then select Add Query to create a query.

  3. Click the area labeled Click here to add a clause to add a row, select the blank Field cell, and in the cell, type Rank. Notice the following message that appears above the results list. This message indicates that the Rank cannot be found.

    Run the query to see the query results. TF51005: The query references a field that does not exist. The error is caused by <<Rank>>.

  4. Delete the value Rank from the Field cell, and type Important Rank into the cell.

  5. Select <> in the Operator cell, and type 1 into the Value cell.

  6. On the Query toolbar, click Run Query Run.

  7. Right-click any row in the results and select Column Options. Scroll down in the Available columns list. Notice that the Rank field is no longer present but the Important Rank field is present.

  8. Select Important Rank in the Available columns box, and then click the add selected columns button, (>). Click OK.

    Notice that the friendly name for Microsoft.VSTS.Common.Rank has been renamed from Rank to Important Rank throughout the query builder and results list.

  9. Click Close to close the query. Click No when you are prompted to save the query.

  10. Create a new Task work item. To do this, right-click the Work Items node, point to Add Work Item, and then click Task.

    This work item is created from the work item type that you changed and imported.

  11. Notice, in the Status box, that the label for the renamed field, Rank, has not changed. This is because the field labels on the work item forms are scoped to the parent team project and are independent of the server-wide field name just specified.

    Note

    For more information about how to change field labels on work item forms, see Changing the Label for a Field.

  12. Click Close to close the new Task. Click No when you are prompted to save the work item.

See Also

Tasks

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

List Work Item Fields and View Attributes Assigned to Fields

Delete a Work Item Field from a Team Project Collection

Reference

Managing Work Item Fields [witadmin]