Enum Access
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การเข้าถึง
อาร์เรย์แบบจำกัดที่แสดงคลาสของผู้ใช้ที่เข้าถึงไฟล์หรือโฟลเดอร์ได้ นอกเหนือจากผู้ใช้แต่ละรายที่ได้รับสิทธิ์เข้าถึงอย่างชัดเจน เข้าถึงพร็อพเพอร์ตี้เหล่านี้ได้จาก DriveApp.Access
หากต้องการเรียกใช้ enum ให้เรียกคลาสหลัก ชื่อ และพร็อพเพอร์ตี้ของ enum นั้น เช่น
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);
พร็อพเพอร์ตี้
พร็อพเพอร์ตี้ | ประเภท | คำอธิบาย |
ANYONE | Enum | ผู้ใช้อินเทอร์เน็ตทุกคนจะค้นหาและเข้าถึงได้ โดยไม่จำเป็นต้องลงชื่อเข้าใช้
ผู้ดูแลระบบโดเมนสามารถห้ามการตั้งค่านี้สำหรับผู้ใช้โดเมน Google Workspace ได้ หากการตั้งค่าปิดอยู่ การนําส่งค่านี้ไปยัง File.setSharing(accessType, permissionType) จะทำให้เกิดข้อยกเว้น
|
ANYONE_WITH_LINK | Enum | ทุกคนที่มีลิงก์จะเข้าถึงได้ โดยไม่จำเป็นต้องลงชื่อเข้าใช้
ผู้ดูแลระบบโดเมนสามารถห้ามการตั้งค่านี้สำหรับผู้ใช้โดเมน Google Workspace ได้ หากการตั้งค่าปิดอยู่ การนําส่งค่านี้ไปยัง File.setSharing(accessType, permissionType) จะทำให้เกิดข้อยกเว้น
|
DOMAIN | Enum | ผู้ใช้ในโดเมนจะค้นหาและเข้าถึงได้ จำเป็นต้องลงชื่อเข้าใช้
การตั้งค่านี้มีไว้สำหรับผู้ใช้โดเมน Google Workspace เท่านั้น สําหรับบัญชี Google ประเภทอื่นๆ การส่งค่านี้ไปยัง File.setSharing(accessType, permissionType) จะทำให้เกิดข้อยกเว้น
|
DOMAIN_WITH_LINK | Enum | ทุกคนในโดเมนที่มีลิงก์จะเข้าถึงได้ จำเป็นต้องลงชื่อเข้าใช้
การตั้งค่านี้มีไว้สำหรับผู้ใช้โดเมน Google Workspace เท่านั้น สําหรับบัญชี Google ประเภทอื่นๆ การส่งค่านี้ไปยัง File.setSharing(accessType, permissionType) จะทำให้เกิดข้อยกเว้น
|
PRIVATE | Enum | เฉพาะคนที่ได้รับอนุญาตอย่างชัดเจนเท่านั้นที่สามารถเข้าถึง จำเป็นต้องลงชื่อเข้าใช้ |
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003e\u003ccode\u003eDriveApp.Access\u003c/code\u003e is an enum used to define user access levels for files and folders in Google Drive, beyond individual permissions.\u003c/p\u003e\n"],["\u003cp\u003eYou can set file or folder sharing permissions using methods like \u003ccode\u003esetSharing()\u003c/code\u003e along with the \u003ccode\u003eDriveApp.Access\u003c/code\u003e and \u003ccode\u003eDriveApp.Permission\u003c/code\u003e enums.\u003c/p\u003e\n"],["\u003cp\u003eSeveral access levels are available: \u003ccode\u003eANYONE\u003c/code\u003e, \u003ccode\u003eANYONE_WITH_LINK\u003c/code\u003e, \u003ccode\u003eDOMAIN\u003c/code\u003e, \u003ccode\u003eDOMAIN_WITH_LINK\u003c/code\u003e, and \u003ccode\u003ePRIVATE\u003c/code\u003e, each controlling who can access the content.\u003c/p\u003e\n"],["\u003cp\u003eDomain administrators in Google Workspace can restrict the use of \u003ccode\u003eANYONE\u003c/code\u003e and \u003ccode\u003eANYONE_WITH_LINK\u003c/code\u003e sharing options for their users.\u003c/p\u003e\n"]]],[],null,["# Enum Access\n\nAccess\n\nAn enum representing classes of users who can access a file or folder, besides any individual\nusers who have been explicitly given access. These properties can be accessed from [DriveApp.Access](/apps-script/reference/drive/drive-app#Access).\n\nTo call an enum, you call its parent class, name, and property. For example, `\nDriveApp.Access.ANYONE`.\n\n```javascript\n// Creates a folder that anyone on the Internet can read from and write to.\n// (Domain administrators can prohibit this setting for users of a Google\n// Workspace domain.)\nconst folder = DriveApp.createFolder('Shared Folder');\nfolder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);\n``` \n\n### Properties\n\n| Property | Type | Description |\n|--------------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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 [File.setSharing(accessType, permissionType)](/apps-script/reference/drive/file#setSharing(Access,Permission)) throws an exception. |\n| `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 [File.setSharing(accessType, permissionType)](/apps-script/reference/drive/file#setSharing(Access,Permission)) throws an exception. |\n| `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 [File.setSharing(accessType, permissionType)](/apps-script/reference/drive/file#setSharing(Access,Permission)) throws an exception. |\n| `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 [File.setSharing(accessType, permissionType)](/apps-script/reference/drive/file#setSharing(Access,Permission)) throws an exception. |\n| `PRIVATE` | `Enum` | Only people explicitly granted permission can access. Sign-in required. |"]]