CreateUserCommand

Creates a user in a Simple AD or Microsoft AD directory. The status of a newly created user is "ACTIVE". New users can access Amazon WorkDocs.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { WorkDocsClient, CreateUserCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
// const { WorkDocsClient, CreateUserCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
const client = new WorkDocsClient(config);
const input = { // CreateUserRequest
  OrganizationId: "STRING_VALUE",
  Username: "STRING_VALUE", // required
  EmailAddress: "STRING_VALUE",
  GivenName: "STRING_VALUE", // required
  Surname: "STRING_VALUE", // required
  Password: "STRING_VALUE", // required
  TimeZoneId: "STRING_VALUE",
  StorageRule: { // StorageRuleType
    StorageAllocatedInBytes: Number("long"),
    StorageType: "UNLIMITED" || "QUOTA",
  },
  AuthenticationToken: "STRING_VALUE",
};
const command = new CreateUserCommand(input);
const response = await client.send(command);
// { // CreateUserResponse
//   User: { // User
//     Id: "STRING_VALUE",
//     Username: "STRING_VALUE",
//     EmailAddress: "STRING_VALUE",
//     GivenName: "STRING_VALUE",
//     Surname: "STRING_VALUE",
//     OrganizationId: "STRING_VALUE",
//     RootFolderId: "STRING_VALUE",
//     RecycleBinFolderId: "STRING_VALUE",
//     Status: "ACTIVE" || "INACTIVE" || "PENDING",
//     Type: "USER" || "ADMIN" || "POWERUSER" || "MINIMALUSER" || "WORKSPACESUSER",
//     CreatedTimestamp: new Date("TIMESTAMP"),
//     ModifiedTimestamp: new Date("TIMESTAMP"),
//     TimeZoneId: "STRING_VALUE",
//     Locale: "en" || "fr" || "ko" || "de" || "es" || "ja" || "ru" || "zh_CN" || "zh_TW" || "pt_BR" || "default",
//     Storage: { // UserStorageMetadata
//       StorageUtilizedInBytes: Number("long"),
//       StorageRule: { // StorageRuleType
//         StorageAllocatedInBytes: Number("long"),
//         StorageType: "UNLIMITED" || "QUOTA",
//       },
//     },
//   },
// };

CreateUserCommand Input

See CreateUserCommandInput for more details

Parameter
Type
Description
GivenName
Required
string | undefined

The given name of the user.

Password
Required
string | undefined

The password of the user.

Surname
Required
string | undefined

The surname of the user.

Username
Required
string | undefined

The login name of the user.

AuthenticationToken
string | undefined

Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API.

EmailAddress
string | undefined

The email address of the user.

OrganizationId
string | undefined

The ID of the organization.

StorageRule
StorageRuleType | undefined

The amount of storage for the user.

TimeZoneId
string | undefined

The time zone ID of the user.

CreateUserCommand Output

See CreateUserCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
User
User | undefined

The user information.

Throws

Name
Fault
Details
EntityAlreadyExistsException
client

The resource already exists.

FailedDependencyException
client

The Directory Service cannot reach an on-premises instance. Or a dependency under the control of the organization is failing, such as a connected Active Directory.

ServiceUnavailableException
server

One or more of the dependencies is unavailable.

UnauthorizedOperationException
client

The operation is not permitted.

UnauthorizedResourceAccessException
client

The caller does not have access to perform the action on the resource.

WorkDocsServiceException
Base exception class for all service exceptions from WorkDocs service.