Skip to main content

Update File Permissions

Updates an existing permission for a file in Google Drive.

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 whose permission should be updated.
  • Permission Id - The unique identifier of the permission to be updated.
  • Role - The new 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.

Output

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

How It Works

The Update File Permissions node modifies an existing permission for a file in Google Drive. When executed, the node:

  1. Validates the required inputs (Drive Id, File Id, Permission 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. Uses the Google Drive API to update the permission with the Permissions.Update method
  5. Returns the updated permission object

Requirements

  • A valid Google Drive connection established using the Connect node
  • The File Id of an existing file in Google Drive
  • The Permission Id of an existing permission on that file
  • 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
  • Empty or invalid Permission Id
  • Invalid Role value
  • Invalid Type value
  • Invalid Email Address
  • Google Drive API errors during permission update
  • Insufficient permissions to modify sharing settings of the file
  • Attempting to update a permission that doesn't exist

Usage Notes

  • This node modifies an existing permission rather than creating a new one
  • The role determines what actions the user or group can perform on the file
  • The type determines what kind of entity has the 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
  • The returned result contains the complete updated permission object with details like permission ID and timestamps
  • You can use the List File Permissions node to find the Permission Id before updating it