Skip to main content

Create File Permission

Creates a new permission for a file in Google Drive, allowing you to share files with specific users or groups.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Drive Id - The identifier for the connected Google Drive service obtained from the Connect node.
  • File Id - The unique identifier of the file for which to create a permission.
  • Role - The role to grant. Valid values include:
    • owner - Full access to the file
    • writer - Can edit the file
    • commenter - Can comment on the file
    • reader - Can view the file
  • Type - The type of entity to grant permission to. Valid values include:
    • user - A specific user
    • group - A Google Group
    • domain - A domain (e.g., example.com)
    • anyone - Anyone on the internet
  • Email Address - The email address of the user or group, or the domain name.

Options

  • Email Message - (Optional) A custom message to include in the email notification sent to the user or group.

Output

  • result - The permission object returned by the Google Drive API, containing details about the created permission.

How It Works

The Create File Permission node adds a new permission to a file in Google Drive, effectively sharing the file with the specified user or group. When executed, the node:

  1. Validates the required inputs (Drive Id, File Id, Role, Type, and Email Address)
  2. Retrieves the Google Drive service client using the provided Drive Id
  3. Creates a Permission object with the specified role, type, and email address
  4. If an Email Message is provided, includes it in the permission creation request
  5. Uses the Google Drive API to create the permission with the Permissions.Create method
  6. Returns the created permission object

Requirements

  • A valid Google Drive connection established using the Connect node
  • The File Id of an existing file in Google Drive
  • Appropriate permissions to modify sharing settings of the file
  • Valid role and type values
  • Valid email address or domain name

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Drive Id
  • Empty or invalid File Id
  • Invalid Role value
  • Invalid Type value
  • Invalid Email Address
  • Google Drive API errors during permission creation
  • Insufficient permissions to modify sharing settings of the file

Usage Notes

  • The role determines what actions the user or group can perform on the file
  • The type determines what kind of entity is being granted permission
  • For type "user", specify the user's email address
  • For type "group", specify the Google Group's email address
  • For type "domain", specify the domain name (e.g., example.com)
  • For type "anyone", no email address is needed
  • If an Email Message is provided, it will be sent to the user or group along with the notification about the shared file
  • The returned result contains the complete permission object with details like permission ID and timestamps