Click or drag to resize
IIdentityProviderAddUser Method
Adds a user to the account.

Namespace: net.openstack.Core.Providers
Assembly: openstacknet (in openstacknet.dll) Version: 1.7.7+Branch.master.Sha.25d803f397c8693c2c13777ef6675f796f520f2c
Syntax
NewUser AddUser(
	NewUser user,
	CloudIdentity identity = null
)

Parameters

user
Type: net.openstack.Core.DomainNewUser
A NewUser object containing the details of the user to create.
identity (Optional)
Type: net.openstack.Core.DomainCloudIdentity
The cloud identity to use for this request. If not specified, the DefaultIdentity for the current provider instance will be used.

Return Value

Type: NewUser
A NewUser object containing the details of the created user.
Exceptions
ExceptionCondition
ArgumentNullExceptionIf user is .
ArgumentExceptionIf user.Username is or empty.
NotSupportedException If the provider does not support the OS-KSADM Admin Extension.

-or-

If the provider does not support the given identity type.

InvalidOperationException If user.Id is not (i.e. user represents a user that already exists).

-or-

If identity is and no default identity is available for the provider.

ServiceConflictExceptionIf a user with the specified Username already exists.
ResponseExceptionIf the REST API request failed.
Remarks
The returned NewUser object will contain the password of the created user. If no Password is specified in user, the returned password will be an automatically generated password from the server.
Caution note Caution
After this call, there is no way to retrieve the password for a user. If the password was auto-generated by the server, make sure to either store the returned value or provide the information to the user for later use.
Examples

The following example demonstrates the use of this method using the CloudIdentityProvider implementation of IIdentityProvider. For more information about creating the provider, see CloudIdentityProvider(CloudIdentity).

NewUser user = new NewUser("{username}", "{email}", enabled: true);
user = provider.AddUser(user, null);
string password = user.Password;
Version Information

.NET Framework

Supported in: 4.5

openstack.net

Supported in: 1.6, 1.5, 1.4, 1.3.6
See Also