Get a list of groups from the repository

Namespace: Perforce.P4
Assembly: p4api.net (in p4api.net.dll) Version: 2015.1.103.4687 (2015.1.103.4687)

Syntax

C#
public IList<Group> GetGroups(
	Options options,
	params string[] groups
)
Visual Basic
Public Function GetGroups ( _
	options As Options, _
	ParamArray groups As String() _
) As IList(Of Group)
Visual C++
public:
IList<Group^>^ GetGroups(
	Options^ options, 
	... array<String^>^ groups
)

Parameters

options
Type: Perforce.P4..::..Options
options for the groups commandGroupsCmdOptions
groups
Type: array<System..::..String>[]()[][]

Return Value

A list containing the matching groups

Remarks


p4 help groups

groups -- List groups (of users)

p4 groups [-m max] [[[-i] user | group] | [-v [group]]]

List all user groups defined in the server. 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 -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 the specified group.

Examples

To get the first 10 groups:
CopyC#
Options opts = new Options(GroupsCmdFlags.None, 10);
IList<Group> groups = _repository.getGroups(opts);
To get all groups that 'Bob' belongs to, including subgroups:
CopyC#
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:
CopyC#
Options opts = new Options(GroupsCmdFlags.IncludeAllValues, -1);
IList<Group> groups = _repository.getGroups(opts);

See Also