AI-generated Key Takeaways
-
DriveApp.Access
is an enum used to define user access levels for files and folders in Google Drive, beyond individual permissions. -
You can set file or folder sharing permissions using methods like
setSharing()
along with theDriveApp.Access
andDriveApp.Permission
enums. -
Several access levels are available:
ANYONE
,ANYONE_WITH_LINK
,DOMAIN
,DOMAIN_WITH_LINK
, andPRIVATE
, each controlling who can access the content. -
Domain administrators in Google Workspace can restrict the use of
ANYONE
andANYONE_WITH_LINK
sharing options for their users.
An enum representing classes of users who can access a file or folder, besides any individual
users who have been explicitly given access. These properties can be accessed from Drive
.
To call an enum, you call its parent class, name, and property. For example,
DriveApp.Access.ANYONE
.
// Creates a folder that anyone on the Internet can read from and write to. // (Domain administrators can prohibit this setting for users of a Google // Workspace domain.) const folder = DriveApp.createFolder('Shared Folder'); folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
Properties
Property | Type | Description |
---|---|---|
ANYONE | Enum | Anyone on the Internet can find and access. No sign-in required.
Domain administrators can prohibit this setting for users of a Google Workspace domain. If
the setting is disabled, passing this value to |
ANYONE_WITH_LINK | Enum | Anyone who has the link can access. No sign-in required.
Domain administrators can prohibit this setting for users of a Google Workspace domain. If
the setting is disabled, passing this value to |
DOMAIN | Enum | People in your domain can find and access. Sign-in required.
This setting is available only for users of a Google Workspace domain. For other types of
Google accounts, passing this value to |
DOMAIN_WITH_LINK | Enum | People in your domain who have the link can access. Sign-in required.
This setting is available only for users of a Google Workspace domain. For other types of
Google accounts, passing this value to |
PRIVATE | Enum | Only people explicitly granted permission can access. Sign-in required. |