تفاوت درایو مشترک در مقابل My Drive API
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
درایوهای مشترک از مدلهای مختلف سازماندهی، اشتراکگذاری و مالکیت در My Drive پیروی میکنند. به این ترتیب، برخی از عملیات My Drive برای محتوای یک درایو مشترک مجاز نیستند.
این راهنما تفاوتهای مشترک API مخصوص درایو را در files
و changes
منابع نشان میدهد.
منبع فایل
فیلدهای زیر در منبع files
فقط برای فایلهای موجود در درایو مشترک پر میشوند:
-
hasAugmentedPermissions
: اینکه آیا به هر کاربر اجازه دسترسی مستقیم به فایل به این فایل داده شده است یا خیر. -
capabilities/canAddFolderFromAnotherDrive
: آیا کاربر فعلی میتواند پوشهای را از درایو دیگری (یک درایو مشترک دیگر یا My Drive) به این پوشه اضافه کند. -
capabilities/canDeleteChildren
: آیا کاربر فعلی می تواند فرزندان این پوشه را حذف کند یا خیر. -
capabilities/canMoveChildrenOutOfDrive
: آیا کاربر فعلی می تواند فرزندان این پوشه را به خارج از درایو مشترک منتقل کند یا خیر. -
capabilities/canMoveChildrenWithinDrive
: آیا کاربر فعلی می تواند فرزندان این پوشه را در درایو مشترک جابجا کند یا خیر. -
capabilities/canMoveItemWithinDrive
: آیا کاربر فعلی می تواند این مورد درایو مشترک را به درایو مشترک منتقل کند یا خیر. -
capabilities/canReadDrive
: آیا کاربر فعلی به درایو مشترکی که این فایل به آن تعلق دارد دسترسی خواندنی دارد یا خیر. -
capabilities/canTrashChildren
: آیا کاربر فعلی می تواند فرزندان این پوشه را حذف کند یا خیر. -
driveId
: شناسه درایو مشترکی که فایل در آن قرار دارد. -
trashingUser
: اگر فایل به صراحت حذف شده باشد، کاربری که آن را سطل زباله کرده است. -
trashedTime
: زمانی که مورد حذف شد. اگر از Drive API نسخه 2 قدیمیتر استفاده میکنید، این فیلد trashedDate
نامیده میشود.
فیلدهای زیر برای فایلهای موجود در درایو مشترک پر نشدهاند:
-
permissions
: با توجه به اندازه بالقوه فهرستهای کنترل دسترسی درایو مشترک (ACL)، مجوزها به عنوان بخشی از فایلها بازگردانده نمیشوند. از روش permissions.list
که از صفحه بندی پشتیبانی می کند، برای فهرست کردن مجوزهای یک فایل در درایو مشترک یا پوشه درایو مشترک استفاده کنید. -
owners
, ownerNames
, ownedByMe
: فایل های موجود در درایو مشترک متعلق به درایو مشترک هستند نه کاربران فردی. -
folderColorRgb
: پوشه ها را نمی توان به صورت جداگانه رنگ کرد. -
shared
: همه موارد در درایو مشترک به اشتراک گذاشته میشوند. -
writersCanShare
: امکان محدود کردن اشتراک گذاری بر اساس نقش در درایوهای مشترک وجود ندارد.
فیلدهای زیر فقط زمانی تنظیم میشوند که به کاربر اجازه دسترسی به فایل در مورد یک مورد داده شده باشد:
-
sharedWithMeDate
-
sharingUser
هنگام استفاده از آنها با درایوهای مشترک، فیلدهای زیر به توجه ویژه نیاز دارند:
-
parents.isRoot
: این فیلد فقط برای پوشه ریشه My Drive صادق است. برای پوشه سطح بالای درایو مشترک نادرست است. parents
: اگر کاربر درخواست کننده عضو درایو مشترک نباشد و به والدین دسترسی نداشته باشد، والدین در لیست والدین ظاهر نمی شوند. علاوه بر این، به استثنای پوشه سطح بالا، اگر فایل در یک درایو مشترک قرار دارد، لیست والدین باید دقیقاً حاوی یک مورد باشد.
capabilities/canRemoveChildren
: از capabilities/canDeleteChildren
یا capabilities/canTrashChildren
استفاده کنید.
تغییر منبع
فیلدهای جدید زیر در منبع changes
برای درایو مشترک موجود است:
-
changeType
: نوع تغییر. مقادیر ممکن file
و drive
هستند. -
driveId
: شناسه درایو مشترک مرتبط با این تغییر. -
drive
: وضعیت به روز شده درایو مشترک. اگر changeType
drive
است و کاربر همچنان عضو درایو مشترک است، ارائه شود.
ممکن است برای برنامه هایی که نیاز به همگام سازی محتوا با درایوهای مشترک یا ردیابی فعالیت دارند، تغییرات بیشتری لازم باشد. برای جزئیات، به پیگیری تغییرات برای کاربران و درایوهای مشترک مراجعه کنید.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-08-29 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# Shared drive versus My Drive API differences\n\nShared drives follow different organization, sharing, and ownership models from\na My Drive. As such, some My Drive operations\naren't permitted for content in a shared drive.\n\nThis guide outlines shared drive-specific API differences in the `files` and\n`changes` resources.\n\nFile resource\n-------------\n\nThe following fields in the [`files`](/workspace/drive/api/reference/rest/v3/files) resource are\nonly populated for files located within a shared drive:\n\n- `hasAugmentedPermissions`: Whether any users are granted file access directly on this file.\n- `capabilities/canAddFolderFromAnotherDrive`: Whether the current user can add a folder from another drive (a different shared drive or My Drive) to this folder.\n- `capabilities/canDeleteChildren`: Whether the current user can delete children of this folder.\n- `capabilities/canMoveChildrenOutOfDrive`: Whether the current user can move children of this folder outside of the shared drive.\n- `capabilities/canMoveChildrenWithinDrive`: Whether the current user can move children of this folder within the shared drive.\n- `capabilities/canMoveItemWithinDrive`: Whether the current user can move this shared drive item within the shared drive.\n- `capabilities/canReadDrive`: Whether the current user has read access to the shared drive to which this file belongs.\n- `capabilities/canTrashChildren`: Whether the current user can trash children of this folder.\n- `driveId`: The ID of the shared drive where the file is located.\n- `trashingUser`: If the file has been explicitly trashed, the user who trashed it.\n- `trashedTime`: The time that the item was trashed. If you're using the older Drive API v2, this field is called `trashedDate`.\n\nThe following fields aren't populated for files located within a shared drive:\n\n- `permissions`: Due to the potential size of shared drive access control lists (ACLs), permissions aren't returned as part of files. Use the `permissions.list` method, which supports pagination, to list permissions for a file within a shared drive or the shared drive folder.\n- `owners`, `ownerNames`, `ownedByMe`: Files within a shared drive are owned by the shared drive, not individual users.\n- `folderColorRgb`: Folders cannot be colored individually.\n- `shared`: All items in a shared drive are shared.\n- `writersCanShare`: It's not possible to restrict sharing by role in shared drives.\n\nThe following fields are only set when the user has been granted file access\npermissions on an item:\n\n- `sharedWithMeDate`\n- `sharingUser`\n\nThe following fields require special consideration when you use them with shared\ndrives:\n\n- `parents.isRoot`: This field is only true for the My Drive root folder; it's false for the shared drive top-level folder.\n- `parents`: A parent doesn't appear in the parents list if the requesting\n user isn't a member of the shared drive and doesn't have access to the\n parent. In addition, with the exception of the top level folder, the parents\n list must contain exactly one item if the file is located within a shared\n drive.\n\n | **Note:** If you're using the older Drive API v2:\n | - `shareable`: Deprecated. Use `capabilities/canShare`.\n | - `editable`: Deprecated. Use `capabilities/canEdit`.\n | - `copyable`: Deprecated. Use `capabilities/canCopy`.\n | - `canComment`: Deprecated. Use `capabilities/canComment`.\n | - `canReadRevisions`: Deprecated. Use `capabilities/canReadRevisions`.\n- `capabilities/canRemoveChildren`: Use `capabilities/canDeleteChildren` or\n `capabilities/canTrashChildren`.\n\nChange resource\n---------------\n\nThe following new fields are available in the\n[`changes`](/workspace/drive/api/reference/rest/v3/changes) resource for a shared drive:\n\n- `changeType`: The change type. Possible values are `file` and `drive`.\n- `driveId`: The ID of the shared drive associated with this change.\n- `drive`: The updated state of the shared drive. Present if the `changeType` is `drive` and the user is still a member of the shared drive.\n\nAdditional changes might be required for applications that need to sync content\nwith shared drives or track activity. For details, see [Track changes for users\nand shared drives](/workspace/drive/api/guides/about-changes).\n\nRelated topics\n--------------\n\n- [Files and folders overview](/workspace/drive/api/guides/about-files)\n- [Changes and revisions overview](/workspace/drive/api/guides/change-overview)"]]