- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
CreateCommentCommand
Adds a new comment to the specified document version.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { WorkDocsClient, CreateCommentCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
// const { WorkDocsClient, CreateCommentCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
const client = new WorkDocsClient(config);
const input = { // CreateCommentRequest
AuthenticationToken: "STRING_VALUE",
DocumentId: "STRING_VALUE", // required
VersionId: "STRING_VALUE", // required
ParentId: "STRING_VALUE",
ThreadId: "STRING_VALUE",
Text: "STRING_VALUE", // required
Visibility: "PUBLIC" || "PRIVATE",
NotifyCollaborators: true || false,
};
const command = new CreateCommentCommand(input);
const response = await client.send(command);
// { // CreateCommentResponse
// Comment: { // Comment
// CommentId: "STRING_VALUE", // required
// ParentId: "STRING_VALUE",
// ThreadId: "STRING_VALUE",
// Text: "STRING_VALUE",
// Contributor: { // 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",
// },
// },
// },
// CreatedTimestamp: new Date("TIMESTAMP"),
// Status: "DRAFT" || "PUBLISHED" || "DELETED",
// Visibility: "PUBLIC" || "PRIVATE",
// RecipientId: "STRING_VALUE",
// },
// };
CreateCommentCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
DocumentId Required | string | undefined | The ID of the document. |
Text Required | string | undefined | The text of the comment. |
VersionId Required | string | undefined | The ID of the document version. |
AuthenticationToken | string | undefined | Amazon WorkDocs authentication token. Not required when using Amazon Web Services administrator credentials to access the API. |
NotifyCollaborators | boolean | undefined | Set this parameter to TRUE to send an email out to the document collaborators after the comment is created. |
ParentId | string | undefined | The ID of the parent comment. |
ThreadId | string | undefined | The ID of the root comment in the thread. |
Visibility | CommentVisibilityType | undefined | The visibility of the comment. Options are either PRIVATE, where the comment is visible only to the comment author and document owner and co-owners, or PUBLIC, where the comment is visible to document owners, co-owners, and contributors. |
CreateCommentCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Comment | Comment | undefined | The comment that has been created. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
DocumentLockedForCommentsException | client | This exception is thrown when the document is locked for comments and user tries to create or delete a comment on that document. |
EntityNotExistsException | client | The resource does not exist. |
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. |
InvalidCommentOperationException | client | The requested operation is not allowed on the specified comment object. |
ProhibitedStateException | client | The specified document version is not in the INITIALIZED state. |
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. |