share_drive_file
Share a Google Drive file or folder with users, groups, domains, or anyone. Set access role, expiration, and notification preferences for secure collaboration.
Instructions
Shares a Google Drive file or folder with a user, group, domain, or anyone with the link.
When sharing a folder, all files inside inherit the permission.
Args: user_google_email (str): The user's Google email address. Required. file_id (str): The ID of the file or folder to share. Required. share_with (Optional[str]): Email address (for user/group), domain name (for domain), or omit for 'anyone'. role (str): Permission role - 'reader', 'commenter', or 'writer'. Defaults to 'reader'. share_type (str): Type of sharing - 'user', 'group', 'domain', or 'anyone'. Defaults to 'user'. send_notification (bool): Whether to send a notification email. Defaults to True. email_message (Optional[str]): Custom message for the notification email. expiration_time (Optional[str]): Expiration time in RFC 3339 format (e.g., "2025-01-15T00:00:00Z"). Permission auto-revokes after this time. allow_file_discovery (Optional[bool]): For 'domain' or 'anyone' shares - whether the file can be found via search. Defaults to None (API default). dry_run (bool): If True, returns a preview and does not create sharing permissions. Defaults to True.
Returns: str: Confirmation with permission details and shareable link.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| user_google_email | Yes | ||
| file_id | Yes | ||
| share_with | No | ||
| role | No | reader | |
| share_type | No | user | |
| send_notification | No | ||
| email_message | No | ||
| expiration_time | No | ||
| allow_file_discovery | No | ||
| dry_run | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |