با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
درایوهای مشترک از مدلهای مختلف سازماندهی، اشتراکگذاری و مالکیت My Drive پیروی میکنند. اگر برنامه شما قرار است فایل هایی را در درایوهای مشترک ایجاد و مدیریت کند، باید پشتیبانی از درایو مشترک را در برنامه خود پیاده سازی کنید. پیچیدگی اجرای شما به عملکرد برنامه شما بستگی دارد.
برای شروع، هنگامی که برنامه شما عملیات زیر را انجام می دهد، باید پارامتر supportsAllDrives=true query را در درخواست های خود بگنجانید:
Drive API v3
files.get
files.list
files.create
files.update
files.copy
files.delete
changes.list
changes.getStartPageToken
permissions.list
permissions.get
permissions.create
permissions.update
permissions.delete
Drive API v2
files.get
files.list
files.insert
files.update
files.patch
files.copy
files.trash
files.untrash
files.delete
files.touch
children.insert
parents.insert
changes.list
changes.getStartPageToken
changes.get
permissions.list
permissions.get
permissions.insert
permissions.update
permissions.patch
permissions.delete
پارامتر supportsAllDrives=true به Google Drive اطلاع می دهد که برنامه شما برای مدیریت فایل ها در درایوهای مشترک طراحی شده است.
برنامههایی که مجوزها را میخوانند یا تغییر میدهند، تغییرات را ردیابی میکنند یا در چندین مجموعه جستجو میکنند، به قابلیتهای درایو مشترک اضافی نیاز دارند. بقیه این سند تغییرات اضافی مورد نیاز برای انجام این وظایف را برجسته می کند.
جستجوی محتوا در درایو مشترک
برای یافتن فایل های کاربر در درایوهای مشترک از روش list در منبع files استفاده کنید. برای جستجوی درایو مشترک، به جستجوی درایوهای مشترک مراجعه کنید.
متد list شامل پارامترهای پرس و جو مخصوص درایو مشترک زیر است:
driveId : شناسه درایو مشترک برای جستجو.
corpora : مجموعه موارد (فایل ها یا اسناد) که پرس و جو در مورد آنها اعمال می شود. بدنه های پشتیبانی شده عبارتند از user , domain , drive و allDrives . برای کارایی user یا drive به allDrives ترجیح دهید. به طور پیش فرض، corpora روی user تنظیم شده است.
includeItemsFromAllDrives : آیا هر دو مورد My Drive و درایو مشترک باید در نتایج گنجانده شوند. اگر موجود نباشد یا روی false تنظیم شود، موارد درایو مشترک برگردانده نمیشوند.
supportsAllDrives : اینکه آیا برنامه درخواست کننده هم My Drive و هم درایو مشترک را پشتیبانی می کند. اگر نادرست باشد، موارد درایو مشترک در پاسخ گنجانده نشده است.
حالتهای پرس و جو زیر مختص درایوهای مشترک هستند:
includeItemsFromAllDrives
corpora
شرح استعلام
true
user
فایلهایی را که کاربر به آنها دسترسی داشته است، از جمله فایلهای درایو مشترک و My Drive را جستوجو میکند.
true
domain
فایلهایی را که در دامنه به اشتراک گذاشته شدهاند، از جمله فایلهای درایو مشترک و My Drive را جستجو میکند.
true
drive
تمام موارد موجود در درایو مشترک مشخص شده را پرس و جو می کند. driveId باید در درخواست مشخص شود.
true
allDrives
فایلهایی را که کاربر به آنها دسترسی داشته است و همه درایوهای مشترکی که در آن عضو هستند را جستجو میکند. توجه داشته باشید که پاسخ ممکن است شامل incompleteSearch:true ، که نشان می دهد برخی از مجموعه ها برای این درخواست جستجو نشده اند.
متد list شامل پارامترهای پرس و جو مخصوص درایو مشترک زیر است:
driveId : درایو مشترکی که تغییرات از آن برگردانده می شود. اگر مشخص شده باشد، شناسههای تغییر به تغییرات موارد در درایو مشترک اشاره دارد که وضعیت فعلی یک فایل را ارائه میکند. برای اشاره به تغییر درایو مشترک خاص، هر دو شناسه درایو مشترک و شناسه تغییر باید به عنوان یک شناسه استفاده شوند.
includeItemsFromAllDrives : آیا فایل های درایو مشترک یا تغییرات باید در لیست تغییرات گنجانده شود.
supportsAllDrives : اینکه آیا برنامه درخواست کننده از درایوهای مشترک پشتیبانی می کند. اگر نادرست باشد، موارد درایو مشترک، از جمله درایوهای مشترک و فایلهای موجود در درایو مشترک، برگردانده نمیشوند.
حالتهای پرس و جو زیر مختص درایوهای مشترک هستند:
includeItemsFromAllDrives
driveId
شرح استعلام
true
خیر
تغییرات منعکس کننده تغییرات فایل های داخل یا خارج از درایوهای مشترک است که کاربر به آنها دسترسی داشته است، و همچنین تغییرات در درایوهای مشترک که کاربر در آن عضو است.
true
بله
تغییرات منعکس کننده تغییرات درایو مشترک خاصی است که مشخص شده و موارد داخل آن درایو مشترک.
پشتیبانی از درایو مشترک را در رابط کاربری Drive فعال کنید
برای دسترسی به محتوای درایو مشترک با استفاده از رابط کاربری Drive، مطمئن شوید که کادر پشتیبانی از درایوهای مشترک را در برگه ادغام رابط کاربری Drive در API Google Drive در کنسول Google Cloud علامت زدهاید. برای اطلاعات بیشتر، به پیکربندی یکپارچگی رابط کاربری Drive مراجعه کنید.
از Google Picker با درایوهای مشترک استفاده کنید
Google Picker از انتخاب موارد در درایوهای مشترک پشتیبانی می کند. برای جزئیات در مورد فعال کردن پشتیبانی درایو مشترک و افزودن نماهای درایوهای مشترک در انتخابگر، به Google Picker API مراجعه کنید.
تاریخ آخرین بهروزرسانی 2025-08-13 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","easyToUnderstand","thumb-up"],["مشکلم را برطرف کرد","solvedMyProblem","thumb-up"],["غیره","otherUp","thumb-up"]],[["اطلاعاتی که نیاز دارم وجود ندارد","missingTheInformationINeed","thumb-down"],["بیشازحد پیچیده/ مراحل بسیار زیاد","tooComplicatedTooManySteps","thumb-down"],["قدیمی","outOfDate","thumb-down"],["مشکل ترجمه","translationIssue","thumb-down"],["مشکل کد / نمونهها","samplesCodeIssue","thumb-down"],["غیره","otherDown","thumb-down"]],["تاریخ آخرین بهروزرسانی 2025-08-13 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Implement shared drive support\n\nShared drives follow different organization, sharing, and ownership models from\nMy Drive. If your app is going to create and manage files on\nshared drives, you must implement shared drive support in your app. The\ncomplexity of your implementation depends on the functionality of your app.\n\nTo begin, you must include the `supportsAllDrives=true` query parameter in your\nrequests when your app performs the following operations: \n\n### Drive API v3\n\n- `files.get`\n- `files.list`\n- `files.create`\n- `files.update`\n- `files.copy`\n- `files.delete`\n- `changes.list`\n- `changes.getStartPageToken`\n- `permissions.list`\n- `permissions.get`\n- `permissions.create`\n- `permissions.update`\n- `permissions.delete`\n\n### Drive API v2\n\n- `files.get`\n- `files.list`\n- `files.insert`\n- `files.update`\n- `files.patch`\n- `files.copy`\n- `files.trash`\n- `files.untrash`\n- `files.delete`\n- `files.touch`\n- `children.insert`\n- `parents.insert`\n- `changes.list`\n- `changes.getStartPageToken`\n- `changes.get`\n- `permissions.list`\n- `permissions.get`\n- `permissions.insert`\n- `permissions.update`\n- `permissions.patch`\n- `permissions.delete`\n\nThe `supportsAllDrives=true` parameter informs Google Drive that your\napplication is designed to handle files on shared drives.\n\nApplications that read or modify permissions, track changes, or search across\nmultiple corpora require additional shared drive capabilities. The remainder of\nthis document highlights additional changes required to perform these tasks.\n\nSearch for content on a shared drive\n------------------------------------\n\nUse the [`list`](/workspace/drive/api/reference/rest/v3/files/list) method on the [`files`](/workspace/drive/api/reference/rest/v3/files) resource to find user files in shared drives. To\nsearch for a shared drive, see [Search for shared\ndrives](/workspace/drive/api/guides/search-shareddrives).\n\nThe `list` method contains the following shared drive-specific query parameters:\n\n- `driveId`: ID of the shared drive to search.\n\n- `corpora`: Bodies of items (files or documents) to which the query applies.\n Supported bodies are `user`, `domain`, `drive`, and `allDrives`. Prefer\n `user` or `drive` to `allDrives` for efficiency. By default, corpora is set\n to `user`.\n\n- `includeItemsFromAllDrives`: Whether both My Drive and shared\n drive items should be included in results. If not present or set to false,\n then shared drive items are not returned.\n\n- `supportsAllDrives`: Whether the requesting application supports both My\n Drive and shared drive. If false, shared drive items are not\n included in the response.\n\nThe following query modes are specific to shared drives:\n\n| `includeItemsFromAllDrives` | `corpora` | Query description |\n|-----------------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `true` | `user` | Queries files that the user has accessed, including both shared drive and My Drive files. |\n| `true` | `domain` | Queries files that are shared to the domain, including both shared drive and My Drive files. |\n| `true` | `drive` | Queries all items in the specified shared drive. The `driveId` must be specified in the request. |\n| `true` | `allDrives` | Queries files that the user has accessed and all shared drives in which they're a member. Note that the response might include `incompleteSearch:true`, indicating that some corpora were not searched for this request. |\n\nTrack changes on a shared drive\n-------------------------------\n\nUse the [`list`](/workspace/drive/api/reference/rest/v3/changes/list) method on the [`changes`](/workspace/drive/api/reference/rest/v3/changes) resource to track changes on a shared drive. For\nmore information, see [Track changes for users and shared\ndrives](/workspace/drive/api/guides/about-changes).\n\nThe `list` method contains the following shared drive-specific query parameters:\n\n- `driveId`: The shared drive from which changes are returned. If specified,\n the change IDs refer to changes to items within the shared drive providing\n the current state of a file. To refer to a specific shared drive change,\n both the shared drive ID and change ID must be used as an identifier.\n\n- `includeItemsFromAllDrives`: Whether shared drive files or changes should be\n included in the list of changes.\n\n- `supportsAllDrives`: Whether the requesting application supports shared\n drives. If false, then shared drive items, including both shared drives and\n files within a shared drive, aren't returned.\n\nThe following query modes are specific to shared drives:\n\n| `includeItemsFromAllDrives` | `driveId` | Query description |\n|-----------------------------|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `true` | No | Changes are reflective of changes to files inside or outside of shared drives that the user has accessed, as well as changes to shared drives in which the user is a member. |\n| `true` | Yes | Changes are reflective of changes to the particular shared drive that was specified and items inside that shared drive. |\n\n| **Note:** If you're using the older Drive API v2, the [`get`](/workspace/drive/api/reference/rest/v2/changes/get) and [`list`](/workspace/drive/api/reference/rest/v2/changes/list) methods have several parameters specific to shared drives.\n\nFor additional details about change log behavior, see [Track changes for users\nand shared drives](/workspace/drive/api/guides/about-changes).\n\nEnable shared drive support in the Drive UI\n-------------------------------------------\n\nTo access shared drive content using the Drive UI, make sure you\nhave checked the\n**Shared drives support** box on the **Drive UI integration** tab\nof the Google Drive API in the\n[Google Cloud console](https://console.cloud.google.com/apis/dashboard). For more\ninformation, see [Configure a Drive UI integration](/workspace/drive/api/guides/enable-sdk).\n\nUse the Google Picker with shared drives\n----------------------------------------\n\nThe [Google Picker](/workspace/drive/api/guides/picker) supports selecting items in shared\ndrives. For details about enabling shared drive support and adding shared drives\nviews in the picker, see the [Google Picker API](/drive/picker/reference/picker).\n\nRelated topics\n--------------\n\n- [Manage shared drives](/workspace/drive/api/guides/manage-shareddrives)"]]