RepositoryGetUsers Method (IListString, Options)
|
Get a list of users from the repository
Namespace:
Perforce.P4
Assembly:
p4api.net (in p4api.net.dll) Version: 2024.2.269.3570
Syntax public IList<User> GetUsers(
IList<string> users,
Options options
)
Public Function GetUsers (
users As IList(Of String),
options As Options
) As IList(Of User)
public:
IList<User^>^ GetUsers(
IList<String^>^ users,
Options^ options
)
member GetUsers :
users : IList<string> *
options : Options -> IList<User>
Parameters
- users
- Type: System.Collections.GenericIListString
user(s) to get - options
- Type: Perforce.P4Options
Options for the users command. See: UsersCmdFlags
Return Value
Type:
IListUserA 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':
UsersCmdOptions opts = new UsersCmdOptions(UsersCmdFlags.None, 10);
IList<String> names = new List<String>();
names.Add("A*");
IList<User> users = Repository.getUsers(names, opts);
To get the users for 'Bob', 'Ted', 'Carol' and 'Alice':
UsersCmdOptions opts = new UsersCmdOptions(UsersCmdFlags.None, -1);
IList<String> names = new List<String>();
names.Add("Bob");
names.Add("Ted");
names.Add("Carol");
names.Add("Alice");
IList<User> users = Repository.getUsers(names, opts);
To get all the users (WARNING, will fetch all users from the repository):
UsersCmdOptions opts = new UsersCmdOptions(UsersCmdFlags.IncludeAll, -1);
IList<User> users = Repository.getUsers(null, opts);
See Also