Method: files.trash
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
ย้ายไฟล์ไปที่ถังขยะ ผู้ใช้ที่ตรวจสอบสิทธิ์อยู่ในขณะนี้ต้องเป็นเจ้าของไฟล์หรือมีสิทธิ์เป็นfileOrganizer
เป็นอย่างน้อยในไฟล์ไดรฟ์ที่แชร์ระดับบน
คำขอ HTTP
POST https://www.googleapis.com/drive/v2/files/{fileId}/trash
URL ใช้ไวยากรณ์การแปลง gRPC
พารามิเตอร์เส้นทาง
พารามิเตอร์ |
fileId |
string
รหัสของไฟล์ที่จะย้ายไปไว้ในถังขยะ
|
พารามิเตอร์การค้นหา
พารามิเตอร์ |
supportsAllDrives |
boolean
แอปพลิเคชันที่ขอรองรับทั้งไดรฟ์ของฉันและไดรฟ์ที่แชร์หรือไม่
|
supportsTeamDrives (deprecated) |
boolean
เลิกใช้งานแล้ว: ให้ใช้ supportsAllDrives แทน
|
includePermissionsForView |
string
ระบุสิทธิ์ของมุมมองเพิ่มเติมที่จะรวมไว้ในคำตอบ รองรับเฉพาะ published เท่านั้น
|
includeLabels |
string
รายการรหัสของป้ายกำกับที่คั่นด้วยคอมมาเพื่อรวมไว้ในส่วน labelInfo ของคำตอบ
|
เนื้อหาของคำขอ
เนื้อหาของคำขอต้องว่างเปล่า
เนื้อหาการตอบกลับ
หากทำสำเร็จ เนื้อหาการตอบกลับจะมีอินสแตนซ์ File
ขอบเขตการให้สิทธิ์
ต้องใช้ขอบเขต OAuth ต่อไปนี้
https://www.googleapis.com/auth/docs
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.appdata
https://www.googleapis.com/auth/drive.apps.readonly
https://www.googleapis.com/auth/drive.file
ขอบเขตบางอย่างถูกจํากัดและต้องมีการประเมินความปลอดภัยเพื่อให้แอปของคุณใช้งานได้ ดูข้อมูลเพิ่มเติมได้ที่คู่มือการให้สิทธิ์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-25 UTC
[null,null,["อัปเดตล่าสุด 2025-07-25 UTC"],[],[],null,["# Method: files.trash\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nMoves a file to the trash. The currently authenticated user must own the file or be at least a `fileOrganizer` on the parent for shared drive files.\n\n### HTTP request\n\n`POST https://www.googleapis.com/drive/v2/files/{fileId}/trash`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|---------------------------------------|\n| `fileId` | `string` The ID of the file to trash. |\n\n### Query parameters\n\n| Parameters ||\n|---------------------------------------|-------------------------------------------------------------------------------------------------------------------|\n| `supportsAllDrives` | `boolean` Whether the requesting application supports both My Drives and shared drives. |\n| `supportsTeamDrives` **(deprecated)** | `boolean` Deprecated: Use `supportsAllDrives` instead. |\n| `includePermissionsForView` | `string` Specifies which additional view's permissions to include in the response. Only `published` is supported. |\n| `includeLabels` | `string` A comma-separated list of IDs of labels to include in the `labelInfo` part of the response. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains an instance of [File](/workspace/drive/api/reference/rest/v2/files#File).\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/docs`\n- `\n https://www.googleapis.com/auth/drive`\n- `\n https://www.googleapis.com/auth/drive.appdata`\n- `\n https://www.googleapis.com/auth/drive.apps.readonly`\n- `\n https://www.googleapis.com/auth/drive.file`\n\nSome scopes are restricted and require a security assessment for your app to use them. For more information, see the [Authorization guide](/workspace/guides/configure-oauth-consent)."]]