AddResourcePermissionsCommand

Creates a set of permissions for the specified folder or document. The resource permissions are overwritten if the principals already have different permissions.

Example Syntax

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

import { WorkDocsClient, AddResourcePermissionsCommand } from "@aws-sdk/client-workdocs"; // ES Modules import
// const { WorkDocsClient, AddResourcePermissionsCommand } = require("@aws-sdk/client-workdocs"); // CommonJS import
const client = new WorkDocsClient(config);
const input = { // AddResourcePermissionsRequest
  AuthenticationToken: "STRING_VALUE",
  ResourceId: "STRING_VALUE", // required
  Principals: [ // SharePrincipalList // required
    { // SharePrincipal
      Id: "STRING_VALUE", // required
      Type: "USER" || "GROUP" || "INVITE" || "ANONYMOUS" || "ORGANIZATION", // required
      Role: "VIEWER" || "CONTRIBUTOR" || "OWNER" || "COOWNER", // required
    },
  ],
  NotificationOptions: { // NotificationOptions
    SendEmail: true || false,
    EmailMessage: "STRING_VALUE",
  },
};
const command = new AddResourcePermissionsCommand(input);
const response = await client.send(command);
// { // AddResourcePermissionsResponse
//   ShareResults: [ // ShareResultsList
//     { // ShareResult
//       PrincipalId: "STRING_VALUE",
//       InviteePrincipalId: "STRING_VALUE",
//       Role: "VIEWER" || "CONTRIBUTOR" || "OWNER" || "COOWNER",
//       Status: "SUCCESS" || "FAILURE",
//       ShareId: "STRING_VALUE",
//       StatusMessage: "STRING_VALUE",
//     },
//   ],
// };

AddResourcePermissionsCommand Input

Parameter
Type
Description
Principals
Required
SharePrincipal[] | undefined

The users, groups, or organization being granted permission.

ResourceId
Required
string | undefined

The ID of the resource.

AuthenticationToken
string | undefined

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

NotificationOptions
NotificationOptions | undefined

The notification options.

AddResourcePermissionsCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
ShareResults
ShareResult[] | undefined

The share results.

Throws

Name
Fault
Details
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.

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.