Click or drag to resize

RepositoryUpdateUser Method (User)

Update the record for a user in the repository

Namespace:  Perforce.P4
Assembly:  p4api.net (in p4api.net.dll) Version: 2023.2.255.3501
Syntax
public User UpdateUser(
	User user
)

Parameters

user
Type: Perforce.P4User
User specification for the user being updated

Return Value

Type: User
The User object if new user was saved, null if creation failed
Remarks
The '-i' flag is added if not specified by the caller

p4 help user

user -- Create or edit a user specification

p4 user [-f] [name]
p4 user -d [-f] name
p4 user -o [name]
p4 user -i [-f]

Create a new user specification or edit an existing user specification.
The specification form is put into a temporary file and the editor
(configured by the environment variable $P4EDITOR) is invoked.

Normally, a user specification is created automatically the first
time that the user issues any command that updates the depot. The
'p4 user' command is typically used to edit the user's subscription
list for change review.

The user specification form contains the following fields:

User: The user name (read-only).

Email: The user's email address (Default: user@client).

Update: The date the specification was last modified (read-only).

Access: The date that the user last issued a client command.

FullName: The user's real name.

JobView: Selects jobs that are displayed when the user creates
a changelist. These jobs can be closed automatically
when the user submits the changelist. For a description
of jobview syntax, see 'p4 help jobview'

Reviews: The subscription list for change review. There is no
limit on the number of lines that this field can contain.
You can include the following wildcards:

... matches any characters including /
* matches any character except /

Password: The user's password. See 'p4 help passwd'.

Type: Must be 'service', operator, or 'standard'. Default is
'standard'. Once set, the user type cannot be changed.

AuthMethod: Must be 'perforce' or 'ldap'. Default is 'perforce'
Unless overridden by the 'auth.default.method'
configurable, see 'p4 help configurables'. AuthMethod
can only be changed when the -f flag has been provided.

The -d flag deletes the specified user (unless the user has files
open).

The -o flag writes the user specification to the standard output.
The user's editor is not invoked.

The -i flag reads a user specification from the standard input.
The user's editor is not invoked.

The -f flag forces the creation, update or deletion of the specified
user, and enables you to change the Last Modified date. By default,
users can only delete or modify their own user specifications. The
-f flag requires 'super' access, which is granted by 'p4 protect'.

Examples
To update a user with the username bsmith (when connected with Connection.UserName = "bsmith"):
User u = Repository.GetUser("bsmith");

// update email address
u.EmailAddress = "[email protected]";

u = Repository.UpdateUser(u, null);
See Also