[TFS2010] HowTo: Delete a WorkItem

image47dd1de4

Good,

delete a WorkItem is not a task that is the most recommended. Mainly because if you’ve created a WI is not useful, i.e. you have the wrong, because who said you make no mistake and delete a WI which is not correct. So on this basis, our friends in Redmond had hidden this option very in the guts of TFS and until the power tools of TFS2008, we had no option to remove a WI.

Team Foundation Server 2010 has incorporated a new tool called WitAdmin which among other things allows us to eliminate a WorkItem from the command-line with the following syntax:

C:\Program Files (x 86) \Microsoft Visual Studio 10.0\Common7\IDE > destroywi /collection witadmin.exe:http:// < tfs>: 8080/tfs/< tpc > / id: < WorkItemId >

where < tfs > is the name of our server, < tpc > is the team Project collection on which we will work and finally < WorkItemId > is the id of the WI you want to delete.

In addition to be able to eliminate a WI, there are other options provided by the tool:

  • changefield

    Changes properties of the field.

    Usage: witadmin changefield /s server d_typename /n [/name newname]
    [/syncnamechanges true|false] [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either use the application-tier server name, or to fully
    specified URL such as http://tfs:8080.
    /n The reference name of the field.
    /name The new name of the field.
    /syncnamechanges Indicates whether or not the field’s values should be
    updated in response to identity name changes.
    /noprompt Turns off the confirmation message.

  • deactivatelinktypeDeactivates the specified link type. Users will no longer be able to create
    new links with this type. Existing links of this type will continue to function
    correctly.

    Usage: deactivatelinktype /s server d_typename /n witadmin

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /n Specifies the link type to society using either the link type name
    or reference name.

  • DeleteField

    Deletes the specified field using the reference name.

    Usage: witadmin deletefield /s server d_typename /n [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /n Specifies the reference name of the field to be deleted.
    /noprompt Turns off the confirmation message.

  • deletelinktype

    Deletes the specified link type from the specified server.

    Usage: witadmin deletelinktype /s server d_typename /n [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /n Specifies the link type to delete. The link name or type
    reference name can be used.
    /noprompt Turns off the confirmation message.

  • destroygloballist

    Destroys a global list.

    Usage: witadmin destroygloballist /s server d_typename /n [/noprompt] [/ force]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /n Specifies the name of the global list to destroy.
    /noprompt Turns off the confirmation message.
    / force Turns off validation that the an item is not in use before being
    destroyed.

  • destroywiDestroys a work item or work items. Currently, work items can only be
    destroyed. Destroying a work item means the item is physically deleted work
    and cannot be restored. The system does not support logical (and thus)
    (recoverable) deletion of work items.

    Usage: witadmin destroywi /s server /id id [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /id Specifies the ID of the work item to destroy. Supports multiple
    IDs delimited by commas such as 12,15,23 (with no whitespace).
    /noprompt Turns off the confirmation message.

  • destroywitdDestroys a work item type. Currently, work item types can only be destroyed.
    Destroying a work item type means that work items of that type are physically
    deleted and cannot be restored. It does not support logical (and thus)
    (recoverable) delete of work item types.

    Usage: witadmin destroywitd /s /p /n d_typename project server [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /p Specifies the name of the team project.
    /n Specifies the name of the work item type to destroy.
    /noprompt Turns off the confirmation message.

  • exportcategories

    Exports the XML definition of a project’s work item type categories.

    Usage: witadmin exportcategories /s /p project server [/f filename] [/e]
    [encoding]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /p Specifies the name of the team project.
    /f Specifies the destination file for exporting the work item type
    XML category. If not specified, the XML is output to the display.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.

  • exportgloballistExports the XML definition of global lists defined on a Team Foundation
    Server.

    Usage: witadmin exportgloballist /s server [/f filename] [/e encoding]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /f Specifies the destination file for exporting the global list XML. When
    It is not specified, the XML is output to the display.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.

  • exportlinktype

    Exports the XML definition of a link type.

    Usage: witadmin exportlinktype /s server [d_typename /n] [/f filename] [/e]
    [encoding]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /n Specifies the name of the work item link type that is to be exported.
    /f Specifies the destination file for exporting the link type XML. When it
    is not specified, the XML is output to the display.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.

  • exportwitd

    Exports the XML definition of a work item type.

    Usage: witadmin exportwitd/s server project d_typename /n /p [/f filename] [/e]
    [encoding] [/exportgloballists]

    /s Specifies the Team Foundation application-tier server.
    Either use the application-tier server name, or to fully
    specified URL such as http://tfs:8080.
    /p Specifies the name of the team project.
    /n Specifies the name of the work item type to export.
    /f Specifies the destination file for exporting the work
    item type XML. If not specified, the XML is output to
    the display.
    /e Specifies the name of the.NET Framework 2.0 encoding
    used to import the XML. For example, /e utf-7 will use
    Unicode (UTF-7) encoding. By default, encoding is
    automatically detected when it is possible. If the
    can not be detected automatically, is UTF-8 encoding
    used.
    /exportgloballists Exports the definitions of referenced global lists. If
    not specified, global list definitions are omitted.

  • importcategoriesThis command imports a work item type categories XML file into a team project on
    a Team Foundation Server. If a category with the same name already exists, the
    new category definition will overwrite the existing definition. If the work
    item type does not already exist, a new category will be created.

    Usage: witadmin importcategories /s /p /f filename project server [/e]
    [encoding]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /p Specifies the team project in which the categories are imported.
    /f Specifies the work item type categories XML file to import.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.

  • importgloballistImports global lists from an XML definition file onto to Team Foundation
    Server. If a global list that has the same name already exists, the imported
    definition will overwrite the existing definition. If a global list does not
    already exist, a new one will be created.

    Usage: witadmin importgloballist /s /f filename server [/e encoding]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /f Specifies the global list XML definition file to be imported.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.

  • importlinktypeImports to link type XML definition file into Team Foundation Server. If a link
    type with the same reference name already exists, it will be updated to match
    the imported link type. If the link type does not already exist, a new link
    type will be created.

    Usage: witadmin importlinktype/s server /f filename [/e encoding] [v]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /f Specifies the file that contains the link type XML to import.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.
    /v Validates the work item type or link type XML without importing it.

  • importwitdThis command imports a work item type XML definition file into a team project
    on a Team Foundation Server. If a work item type with the same name already
    exists, the new work item type definition will overwrite the existing
    definition. If the work item type does not already exist, a new work item type
    will be created.

    Usage: witadmin importwitd/s server [/p project] /f filename [/e encoding]
    [v]

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /p Specifies the team project in which the new work item type is imported.
    This is required, except when the validation-only option is used.
    /f Specifies the work item type XML definition file to import.
    /e Specifies the name of the.NET Framework 2.0 encoding used to import
    the XML. For example, /e utf-7 will use Unicode (UTF-7) encoding. By
    default encoding is automatically detected when it is possible. If the
    encoding can not be detected automatically, UTF-8 is used.
    /v Validates the work item type or link type XML without importing it.

  • indexfield

    This command turns indexing for a field on or off.

    Usage: witadmin indexfield server name /index on|off /n /s

    /s Specifies the Team Foundation application-tier server. Either use
    the application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /n The reference name of the field whose information will be indexing
    updated.
    /index Specifies whether the field should be indexed.

  • ListFieldsShows field information. By default, this lists all fields on the Team
    Foundation Server. Optional parameters can be used to list only specific
    fields.

    Usage: witadmin listfields /s server [/n d_typename] [/unused]

    /s Specifies the Team Foundation application-tier server. Either use
    the application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /n The reference name of the field to display.
    /unused Shows all fields that are not being used on the Team Foundation
    Server.

  • listgloballist

    Lists the names of the global lists on a server.

    Usage: listgloballist /s server witadmin

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.

  • listlinktypes

    Lists the available set of link types on a server.

    Usage: listlinktypes /s server witadmin

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.

  • listwitd

    Lists the names of the work item types in the given project.

    Usage: listwitd /s /p project server witadmin

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /p Specifies the name of the team project.

  • reactivatelinktypeActivates the specified link type. Users will be able to create new links
    with this type.

    Usage: reactivatelinktype /s server d_typename /n witadmin

    /s Specifies the Team Foundation application-tier server. Either use the
    application-tier server name, or to fully specified URL such as
    http://TFS:8080.
    /n Specifies the link type to activate using either the name or reference
    name.

  • rebuildcacheThis command invalidates cached data about work item types on all clients.
    Each client will refresh its cache the next time that it connects to the
    Server. To avoid server performance issues, you should not run this command
    during typical operating hours.

    Usage: witadmin rebuildcache /s server [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /noprompt Turns off the confirmation message.

  • renamewitdRename an existing work item type. Changes the display name of a work item
    type within a specific project. Also, the work items of that type are updated
    to reflect the new work item type name.

    Usage: renamewitd /s /p /n d_typename /new newname project server witadmin
    [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /p Specifies the name of the team project.
    /n Specifies the name of the work item type to rename.
    /new Specifies the new name for the work item type.
    /noprompt Turns off the confirmation message.

  • reportfieldSpecifies whether and how the field is included in the data warehouse for
    reporting. For more information about how to use fields for reporting, see
    http://go.microsoft.com/fwlink/?LinkId = 78060.

    Usage: witadmin reportfield /s server /t type d_typename /n [/formula formula]
    [/noprompt]

    /s Specifies the Team Foundation application-tier server. Either
    use the application-tier server name, or to fully specified URL
    such as http://tfs:8080.
    /n Reference name of the field.
    /t Specifies how the field is used in the warehouse for reporting
    (dimension, detail, measure, disable).
    /formula Specifies to formula when the field is reported as a measure. The
    only supported formula is sum.
    /noprompt Turns off the confirmation message.

Greetings @ Alicante

The Bruno

   

WitAdmin references: http://blogs.microsoft.co.il/blogs/shair/archive/2009/05/20/visual-studio-2010-witadmin-command-line-utility-commands.aspx

One thought on “[TFS2010] HowTo: Delete a WorkItem

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.