Class PlatformDataSource
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Plate-formeSourcede données
Pour un widget SelectionInput
qui utilise un menu à sélection multiple, une source de données Google Workspace. Permet de renseigner les éléments d'un menu à sélection multiple.
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);
Disponible uniquement pour les applications Google Chat. Non disponible pour les modules complémentaires Google Workspace.
Documentation détaillée
setCommonDataSource(commonDataSource)
Définit la source de données à partir de 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);
Disponible uniquement pour les applications Google Chat. Non disponible pour les modules complémentaires Google Workspace.
Paramètres
Renvois
PlatformDataSource
: cet objet, pour le chaînage.
setHostAppDataSource(hostAppDataSource)
Permet de renseigner les espaces dans le menu à sélection multiple.
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);
Disponible uniquement pour les applications Google Chat. Non disponible pour les modules complémentaires Google Workspace.
Paramètres
Renvois
PlatformDataSource
: cet objet, pour le chaînage.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/07/26 (UTC).
[null,null,["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\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."]]