Enum Access

  • TheAccess enum represents classes of users who can access a file or folder in Google Drive.

  • To use anAccess enum, you callDriveApp.Access followed by the specific access property, such asDriveApp.Access.ANYONE.

  • The availableAccess properties includeANYONE,ANYONE_WITH_LINK,DOMAIN,DOMAIN_WITH_LINK, andPRIVATE.

  • ANYONE andANYONE_WITH_LINK allow access without sign-in, whileDOMAIN,DOMAIN_WITH_LINK, andPRIVATE require sign-in.

  • Domain administrators can restrict theANYONE andANYONE_WITH_LINK settings for Google Workspace users.

Access

An enum representing classes of users who can access a file or folder, besides any individualusers who have been explicitly given access. These properties can be accessed fromDriveApp.Access.

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.)constfolder=DriveApp.createFolder('Shared Folder');folder.setSharing(DriveApp.Access.ANYONE,DriveApp.Permission.EDIT);

Properties

PropertyTypeDescription
ANYONEEnumAnyone on the Internet can find and access. No sign-in required.

Domain administrators can prohibit this setting for users of a Google Workspace domain. Ifthe setting is disabled, passing this value toFile.setSharing(accessType, permissionType) throws an exception.

ANYONE_WITH_LINKEnumAnyone who has the link can access. No sign-in required.

Domain administrators can prohibit this setting for users of a Google Workspace domain. Ifthe setting is disabled, passing this value toFile.setSharing(accessType, permissionType) throws an exception.

DOMAINEnumPeople 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 ofGoogle accounts, passing this value toFile.setSharing(accessType, permissionType) throwsan exception.

DOMAIN_WITH_LINKEnumPeople 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 ofGoogle accounts, passing this value toFile.setSharing(accessType, permissionType) throwsan exception.

PRIVATEEnumOnly people explicitly granted permission can access. Sign-in required.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-11 UTC.