Partager via


Expand list items and exclude groups from lists

Azure DevOps Server 2022 - Azure DevOps Server 2019 | TFS 2018 - TFS 2013

You can expand and filter lists by using the expanditems and filteritems attributes. You can apply these attributes to these list type elements: ALLOWEDVALUES, SUGGESTEDVALUES, and PROHIBITEDVALUES.

To better understand how these attributes are used to populate a field's drop-down menu, review the examples provided below.

Expand lists and groups

You can assign the values true and false to expanditems; its value is true by default. When expanditems has the value of true, list items that represent groups or global lists are expanded recursively. A group's subgroups are expanded; the subgroups of those subgroups are also expanded, and continues in this pattern. After expansion, list items that represented groups include both groups and users as list item values. If expanditems is set to false, no group or global list expansion is performed.

Exclude groups

You can assign only the value excludegroups to the filteritems attribute. When this attribute appears, all the list items are evaluated and any groups are removed. Use the filteritems attribute to show only users, not groups.

Contents of lists and groups used in the examples

The examples provided in this topic use the following values:

Group name and list

Description

[Project]\Business Analysts

  • Chuck Reinhart
  • Christie Church
  • Raisa Pokrovskaya

A project group that contains the names of three business analyst team members.

Note

Use the literal prefix [Project] instead of using the actual name of the project.

Example1\MyReports

  • Development
  • dev user
  • Test
  • Test user
  • Program Management
  • pm user
  • juser

A project group that contains one team member, juser, and three subgroups, where each subgroup contains the name of one team member.

Example1\MyReports

  • User One
  • User Two
  • User Three
  • My Remotes
  • User Four
  • User Five

A project group that contains the names of three team members and one subgroup, which contains the names of two team members.

BoolValues

  • true
  • false

A global list with two entries.

Example: Expand lists and exclude groups

In this example, the field contains a string value, a group, and a global list. At the time the work item is displayed, the list is expanded and groups are excluded.

Example

Drop down list values

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups"> 
<LISTITEM value="string" /> 
<LISTITEM value="[Project]\Business Analysts" />  
<GLOBALLIST name="BoolValues" /> 
  • string
  • true
  • false
  • Francis Totten
  • Helena Petersen
  • Jia-hao Tseng

Example: Expand lists and groups and don't filter

In this example, the field contains a string value, two groups, and a global list. At the time the work item is displayed, the list is expanded and groups aren't excluded.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="true">
<LISTITEM value="string" />
<LISTITEM value="Example1\MyReports"/>
<LISTITEM value="Example1\MyTeam" />
<GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES> 
  • string
  • true
  • false
  • juser
  • juser2
  • devuser
  • testuser
  • pmuser
  • Development
  • Test
  • Program Management

Example: Don't expand lists or groups, and don't filter

In this example, the field contains a string value, two groups, and a global list. At run time, the list is not expanded and groups aren't filtered out. When lists aren't expanded, group names are displayed, but not the users within those groups.

Note

The global list name and contents aren't displayed.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="false">
<LISTITEM value="string" />
<LISTITEM value="Example1\MyReports"/>
<LISTITEM value="Example1\MyTeam" />
<GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES> 
  • string
  • MyTeam
  • MyReports

Example: Expand lists and exclude groups and global lists

In this example, the field contains a string value, one group, and a global list. At run time, the list is expanded and groups are filtered out.

Note

MyTeam is a group that is excluded and not expanded, and BoolValues is a global list, so neither one is expanded or shown.

Example

Drop-down list values

<ALLOWEDVALUES expanditems="true" filteritems="excludegroups">
<LISTITEM value="string" />
<LISTITEM value="Example\MyTeam" />
<GLOBALLIST name="BoolValues" />
</ALLOWEDVALUES> 

String