Get a list of users from the repository

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

Syntax

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

Parameters

options
Type: Perforce.P4..::..Options
Options for the users command. See: UsersCmdFlags
user
Type: array<System..::..String>[]()[][]
Optional list of users.

Return Value

A list containing the matching users

Remarks


p4 help users

users -- List Perforce users

p4 users [-l -a -r -c] [-m max] [user ...]

Lists all Perforce users or users that match the 'user' argument.
The report includes the last time that each user accessed the system.

The -m max flag limits output to the first 'max' number of users.

The -a flag includes service and operator users in the output.

The -l flag includes additional information in the output. The -l
flag requires 'super' access, which is granted by 'p4 protect'.

The -r and -c flags are only allowed on replica servers. When
-r is given only users who have used a replica are reported and
when -c is given only the user information from the central server
is reported. Otherwise on a replica server, the user list will
be slightly different from the master server as the user access times
will reflect replica usage or master usage whichever is newer.

Examples

To get the first 10 users that start with the letter 'A':
CopyC#
UsersCmdOptions opts = new UsersCmdOptions(UsersCmdFlags.None, 10);
IList<User> users = Repository.getUsers(opts, "A*");
To get the users for 'Bob', 'Ted', 'Carol' and 'Alice':
CopyC#
UsersCmdOptions opts = new UsersCmdOptions(UsersCmdFlags.None, -1);
IList<User> users = Repository.getUsers(opts, "Bob", "Ted", "Carol", "Alice");
To get all the users (WARNING, will fetch all users from the repository):
CopyC#
UsersCmdOptions opts = new UsersCmdOptions(UsersCmdFlags.IncludeAll, -1);
IList<User> users = Repository.getUsers(opts, null);

See Also