Restez organisé à l'aide des collections Enregistrez et classez les contenus selon vos préférences.
ChatEspaceSourcede données
Source de données qui renseigne les espaces Google Chat en tant qu'éléments de sélection pour un menu à sélection multiple. Ne renseigne que les espaces dont l'utilisateur est membre.
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).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Il n'y a pas l'information dont j'ai besoin","missingTheInformationINeed","thumb-down"],["Trop compliqué/Trop d'étapes","tooComplicatedTooManySteps","thumb-down"],["Obsolète","outOfDate","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Mauvais exemple/Erreur de code","samplesCodeIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/07/26 (UTC)."],[[["\u003cp\u003eChatSpaceDataSource populates Google Chat spaces as selection items in a multiselect menu, limited to spaces the user has joined.\u003c/p\u003e\n"],["\u003cp\u003eIt's exclusively for Google Chat apps and unavailable for Google Workspace Add-ons.\u003c/p\u003e\n"],["\u003cp\u003eThis data source can be configured to default to the current Chat space as a selected item in the menu.\u003c/p\u003e\n"]]],["`ChatSpaceDataSource` populates a multiselect menu with Google Chat spaces the user belongs to. `setDefaultToCurrentSpace(true)` sets the current Chat space as the default selection in the menu. This functionality is exclusively for Google Chat apps, not Google Workspace add-ons. The `setDefaultToCurrentSpace` method takes a boolean as input and returns the `ChatSpaceDataSource` object. `newChatSpaceDataSource()` is used to create the object.\n"],null,["ChatSpaceDataSource\n\nA data source that populates Google Chat spaces as selection items for a multiselect menu. Only\npopulates spaces that the user is a member of.\n\n```javascript\nconst chatSpaceDataSource =\n CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);\n```\n\nOnly available for Google Chat apps. Not available for Google Workspace add-ons. \n\nMethods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------------------------|--------------------------|------------------------------------------------------------------------------------------------------|\n| [setDefaultToCurrentSpace(defaultToCurrentSpace)](#setDefaultToCurrentSpace(Boolean)) | [ChatSpaceDataSource](#) | If set to `true`, the multi select menu selects the current Google Chat space as an item by default. |\n\nDetailed documentation \n\n`set``Default``To``Current``Space(defaultToCurrentSpace)` \nIf set to `true`, the multi select menu selects the current Google Chat space as an item\nby default.\n\n```javascript\nconst chatSpaceDataSource =\n CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\nParameters\n\n| Name | Type | Description |\n|-------------------------------|-----------|------------------------|\n| `default``To``Current``Space` | `Boolean` | The boolean to be set. |\n\nReturn\n\n\n[ChatSpaceDataSource](#) --- This object, for chaining."]]