Manage global lists for work item types

TFS 2018 | TFS 2017 | TFS 2015 | TFS 2013

Important

With witadmin, you can modify XML definition files to support the On-premises XML process model. For Hosted XML and Inheritance process models, you can only use witadmin commands to list information. For an overview of process models and what is supported, see Customize your work tracking experience.

Global lists are pick lists that you can include in one or more fields and types of work items. Use them to minimize the work that is required to update a list that is shared by multiple types of work items. Because global lists are defined for a team project collection, they can be included in work item types for all team projects within the collection.

Note

Feature availability: Hosted XML customization for VSTS supports adding and updating global lists with a process update. To learn more, see Differences between VSTS and TFS process template customizations.

You can define a global list within its own definition file, in the definition file for a type of work item, or in global workflow. The global-list definition manages the global lists that are defined for a collection. The global-list definition uses the following commands in the witadmin command-line tool:

  • destroygloballist: Destroys a global list.
  • exportgloballist: Exports the global lists to an XML file, or to the Command Prompt window. It exports a single file, which contains all global lists that have been defined for the team project collection. (can run against Visual Studio Team Services (VSTS))
  • importgloballist: Imports global lists from an XML file. If you try to import a global list that already exists on the server, a warning asks if you want to overwrite the global list that is on the server. If you try to import a global list that does not already exist, the command creates a new global list.
  • listgloballist: Displays the name of each global list defined on the server. (can run against VSTS)

    See GLOBALLIST XML element reference.

To run the witadmin command-line tool, open a Command Prompt window where Visual Studio is installed. The witadmin command-line tool installs with any version of Visual Studio. You can access this tool by installing the free version of Visual Studio Community.

Version Change directory
TFS 2018 cd %programfiles(x86)%\Microsoft Visual Studio 16.0\Common7\IDE
TFS 2017 cd %programfiles(x86)%\Microsoft Visual Studio 15.0\Common7\IDE
TFS 2015 cd %programfiles(x86)%\Microsoft Visual Studio 14.0\Common7\IDE
TFS 2013 cd %programfiles(x86)%\Microsoft Visual Studio 12.0\Common7\IDE

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

Tip

With witadmin, you can import and export definition files. Other tools you can use include the Process Editor (requires that you have installed a version of Visual Studio):

Or, you can use the TFS Team Project Manager, an open-source client available from github.

Requirements

For the team project collection where the global lists are defined, you must have the following permissions set:

  • To export or list global lists, you must be a member of the Project Collection Valid Users group or have your View collection-level information permission set to Allow.
  • To import global lists, you must be a member of the Project Collection Administrators security group.
  • To destroy a global list using witadmin destroygloballist, you must be a member of the Project Collection Administrators security group.
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 Command Prompt shortcut window, and choose Run as Administrator. For more information, see this page on the Microsoft Web site: User Access Control.

Syntax

witadmin destroygloballist /collection:CollectionURL /n:GlobalListName [/noprompt] [/force]    
witadmin exportgloballist /collection:CollectionURL [/f:FileName] [/e:Encoding]    
witadmin importgloballist /collection:CollectionURL /f:FileName [/e:Encoding]   
witadmin listgloballist /collection:CollectionURL  

Parameters

Parameter Description
/collection:CollectionURL Specifies the URI of the team project collection or VSTS account. For example:

On-premises TFS format: http://ServerName:Port/VirtualDirectoryName/CollectionName

If no virtual directory is used, then the format for the URI is the following: http://ServerName:Port/CollectionName.

VSTS format: http:// AccountName.visualstudio.com.DefaultCollection
/n:GlobalListName The name of the global list to destroy.
/f:FileName The path and the name of the global list XML definition file to export or import. Note: If the client computer runs Windows Vista, you might not have permissions to certain folders. If you try to export the global list to a location where you do not have permissions, the registry virtualization technology automatically redirects the exported file and saves it to the virtual store. For more information, see the following pages on the Microsoft Web site: Registry Virtualization and Common file and registry virtualization issues in Windows Vista. To avoid this redirection, you can export the file to a location where you have permissions.
/e:Encoding The name of a .NET Framework 2.0 encoding format. The specified encoding will be used to export or import the XML data. For example, /e utf-7 specifies Unicode (UTF-7) encoding. If you omit this parameter, witadmin attempts to detect the encoding, and if detection fails, witadmin uses UTF-8.
/noprompt Disables the prompt for confirmation.
/? or help Displays help about the command in the Command Prompt window.

Remarks

Importing a global list creates a list if one does not exist. If the list already exists, the witadmin importgloballist command will warn you that the current list will be overwritten. You can write your own program to update an existing global list, or you can update the global list yourself with the new data.

To create a new global list, start with the following code and modify it as needed. This example defines a global list of disciplines that you can assign to tasks.

<?xml version="1.0" encoding="utf-8"?>  
<gl:GLOBALLISTS xmlns:gl="http://schemas.microsoft.com/VisualStudio/2005/workitemtracking/globallists"> <GLOBALLIST name="Disciplines"> <LISTITEM value="Architecture" /> <LISTITEM value="Requirements" /> <LISTITEM value="Development" /> <LISTITEM value="Release Management" /> <LISTITEM value="Project Management" /> <LISTITEM value="Test" /> </GLOBALLIST></gl:GLOBALLISTS>  

Don't include project-scoped security groups within a global list, because global lists are scoped to a collection and not a project.

To add a global list to a field, export the definition for the work item type that contains the field and add it to the field definition, as shown in the following example:

<FIELD name="Discipline" refname="Microsoft.VSTS.Common.Discipline" type="String">  
  <HELPTEXT>The discipline to which the task belongs</HELPTEXT>  
  <ALLOWEDVALUES>  
     <GLOBALLIST name="Disciplines" />  
  </ALLOWEDVALUES>  
</FIELD>  

To view the changes, import the type definition and refresh your browser or client cache. You might need to close any work items that reference the field and reopen them.

For information about export and import of type definitions, see Import, export, and manage work item types.

Examples

Unless otherwise specified, the following values apply in each example:

Display the names of global lists

The following example shows the global lists defined on the server. The example exports the global lists using the default UTF-8 encoding:

witadmin listgloballist /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection   

Export the definition of global lists

The following example exports the global lists:

witadmin exportgloballist /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /f:C:mygloballists.xml  

The following example exports the same global lists to the same server, but uses Unicode (UTF-7) encoding:

witadmin exportgloballist /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /f:C:mygloballists.xml /e:utf-7  

Import the definition of global lists

The following example imports global lists:

witadmin importgloballist /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /f:C:mygloballists.xml   

The following example imports the same global lists to the same server, but uses Unicode (UTF-7) encoding:

witadmin importgloballist /collection:http://AdventureWorksServer:8080/tfs/DefaultCollection /f:C:mygloballists.xml /e utf-7