Class PlatformDataSource
با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
منبع داده پلتفرم برای ویجت Selection Input
که از منوی چند انتخابی، منبع داده از Google Workspace استفاده می کند. برای پر کردن آیتم ها در منوی چند انتخابی استفاده می شود.
const platformDataSource =
CardService.newPlatformDataSource().setCommonDataSource(
CardService.CommonDataSource.USER,
);
const multiSelect = CardService.newSelectionInput()
.setType(CardService.SelectionInputType.MULTI_SELECT)
.setFieldName('contacts')
.setTitle('Selected contacts')
.setMultiSelectMaxSelectedItems(5)
.setMultiSelectMinQueryLength(1)
.setPlatformDataSource(platformDataSource);
فقط برای برنامههای گپ Google در دسترس است. برای افزونه های Google Workspace در دسترس نیست.
مستندات دقیق
set Common Data Source(commonDataSource)
منبع داده را از Google Workspace تنظیم می کند.
const platformDataSource =
CardService.newPlatformDataSource().setCommonDataSource(
CardService.CommonDataSource.USER,
);
const multiSelect = CardService.newSelectionInput()
.setType(CardService.SelectionInputType.MULTI_SELECT)
.setFieldName('contacts')
.setTitle('Selected contacts')
.setMultiSelectMaxSelectedItems(5)
.setMultiSelectMinQueryLength(1)
.setPlatformDataSource(platformDataSource);
فقط برای برنامههای گپ Google در دسترس است. برای افزونه های Google Workspace در دسترس نیست.
پارامترها
نام | تایپ کنید | توضیحات |
---|
common Data Source | Common Data Source | منبع داده ای که باید تنظیم شود. |
بازگشت
Platform Data Source
- این شی، برای زنجیرهبندی.
set Host App Data Source(hostAppDataSource)
برای پر کردن فضاها در منوی چند انتخابی استفاده می شود.
const chatSpaceDataSource =
CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);
const chatClientDataSource =
CardService.newChatClientDataSource().setSpaceDataSource(
chatSpaceDataSource);
const hostAppDataSource =
CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);
const platformDataSource =
CardService.newPlatformDataSource().setHostAppDataSource(hostAppDataSource);
const multiSelect = CardService.newSelectionInput()
.setType(CardService.SelectionInputType.MULTI_SELECT)
.setFieldName('contacts')
.setTitle('Selected contacts')
.setMultiSelectMaxSelectedItems(5)
.setMultiSelectMinQueryLength(1)
.setPlatformDataSource(platformDataSource);
فقط برای برنامههای گپ Google در دسترس است. برای افزونه های Google Workspace در دسترس نیست.
پارامترها
بازگشت
Platform Data Source
- این شی، برای زنجیرهبندی.
جز در مواردی که غیر از این ذکر شده باشد،محتوای این صفحه تحت مجوز Creative Commons Attribution 4.0 License است. نمونه کدها نیز دارای مجوز Apache 2.0 License است. برای اطلاع از جزئیات، به خطمشیهای سایت Google Developers مراجعه کنید. جاوا علامت تجاری ثبتشده Oracle و/یا شرکتهای وابسته به آن است.
تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی.
[null,null,["تاریخ آخرین بهروزرسانی 2025-07-24 بهوقت ساعت هماهنگ جهانی."],[[["\u003cp\u003e\u003ccode\u003ePlatformDataSource\u003c/code\u003e is used to populate items in a multiselect menu for a \u003ccode\u003eSelectionInput\u003c/code\u003e widget within Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt allows developers to set data sources from Google Workspace using \u003ccode\u003esetCommonDataSource\u003c/code\u003e such as Users.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can also use \u003ccode\u003esetHostAppDataSource\u003c/code\u003e to populate spaces in the multiselect menu.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is exclusive to Google Chat apps and is not available for Google Workspace Add-ons.\u003c/p\u003e\n"]]],[],null,["# Class PlatformDataSource\n\nPlatformDataSource\n\nFor a [SelectionInput](/apps-script/reference/card-service/selection-input) widget that uses a multiselect menu, a data source from Google\nWorkspace. Used to populate items in a multiselect menu.\n\n```javascript\nconst platformDataSource =\n CardService.newPlatformDataSource().setCommonDataSource(\n CardService.CommonDataSource.USER,\n );\n\nconst multiSelect = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.MULTI_SELECT)\n .setFieldName('contacts')\n .setTitle('Selected contacts')\n .setMultiSelectMaxSelectedItems(5)\n .setMultiSelectMinQueryLength(1)\n .setPlatformDataSource(platformDataSource);\n```\n\nOnly available for Google Chat apps. Not available for Google Workspace add-ons. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------------------------------|-------------------------|----------------------------------------------|\n| [setCommonDataSource(commonDataSource)](#setCommonDataSource(CommonDataSource)) | [PlatformDataSource](#) | Sets the data source from Google Workspace. |\n| [setHostAppDataSource(hostAppDataSource)](#setHostAppDataSource(HostAppDataSource)) | [PlatformDataSource](#) | Used to populate spaces in multiselect menu. |\n\nDetailed documentation\n----------------------\n\n### `set``Common``Data``Source(commonDataSource)`\n\nSets the data source from Google Workspace.\n\n```javascript\nconst platformDataSource =\n CardService.newPlatformDataSource().setCommonDataSource(\n CardService.CommonDataSource.USER,\n );\n\nconst multiSelect = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.MULTI_SELECT)\n .setFieldName('contacts')\n .setTitle('Selected contacts')\n .setMultiSelectMaxSelectedItems(5)\n .setMultiSelectMinQueryLength(1)\n .setPlatformDataSource(platformDataSource);\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n#### Parameters\n\n| Name | Type | Description |\n|------------------------|----------------------------------------------------------------------------|----------------------------|\n| `common``Data``Source` | [CommonDataSource](/apps-script/reference/card-service/common-data-source) | The data source to be set. |\n\n#### Return\n\n\n[PlatformDataSource](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Host``App``Data``Source(hostAppDataSource)`\n\nUsed to populate spaces in multiselect menu.\n\n```javascript\nconst chatSpaceDataSource =\n CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);\n\nconst chatClientDataSource =\n CardService.newChatClientDataSource().setSpaceDataSource(\n chatSpaceDataSource);\n\nconst hostAppDataSource =\n CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);\n\nconst platformDataSource =\n CardService.newPlatformDataSource().setHostAppDataSource(hostAppDataSource);\n\nconst multiSelect = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.MULTI_SELECT)\n .setFieldName('contacts')\n .setTitle('Selected contacts')\n .setMultiSelectMaxSelectedItems(5)\n .setMultiSelectMinQueryLength(1)\n .setPlatformDataSource(platformDataSource);\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------------------|-------------------------------------------------------------------------------|----------------------------|\n| `host``App``Data``Source` | [HostAppDataSource](/apps-script/reference/card-service/host-app-data-source) | The data source to be set. |\n\n#### Return\n\n\n[PlatformDataSource](#) --- This object, for chaining."]]