Click or drag to resize

RepositoryGetGroups Method

Get a list of groups from the repository

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2024.1.265.5426
Syntax
public IList<Group> GetGroups(
	Options options,
	params string[] groups
)

Parameters

options
Type: Perforce.P4Options
options for the groups commandGroupsCmdOptions
groups
Type: SystemString
groups

Return Value

Type: IListGroup
A list containing the matching groups
Remarks

p4 help groups

groups -- List groups (of users)

p4 groups [-m max] [-v] [group]
p4 groups [-m max] [-i [-v]] user | group
p4 groups [-m max] [-g | -u | -o] name

The first form lists all user groups defined in the server, or just
the specified group.

The second form displays subgroup relationships. If a user argument is
specified, only groups containing that user are displayed. If a group
argument is specified, only groups containing the group are displayed.

The third form is useful when there are groups and users with the
same name, or when requesting all groups owned by a certain user.

The -i flag also displays groups that the user or group belongs to
indirectly by means of membership in subgroups.

The -m max flag limits output to the specified number of groups.

The -v flag displays the MaxResults, MaxScanRows, MaxLockTime, and
Timeout values for each group that is displayed.

The -g flag indicates that the 'name' argument is a group.

The -u flag indicates that the 'name' argument is a user.

The -o flag indicates that the 'name' argument is an owner.

Examples
To get the first 10 groups:
Options opts = new Options(GroupsCmdFlags.None, 10);
IList<Group> groups = _repository.getGroups(opts);
To get all groups that 'Bob' belongs to, including subgroups:
Options opts = new Options(GroupsCmdFlags.IncludeIndirect, -1);
IList<Group> groups = _repository.getGroups(opts, "Bob");
To get all the groups with the MaxResults, MaxScanRows, MaxLockTime, and Timeout values for the specified group:
Options opts = new Options(GroupsCmdFlags.IncludeAllValues, -1);
IList<Group> groups = _repository.getGroups(opts);
See Also