Class ChatSpaceDataSource

  • ChatSpaceDataSource populates Google Chat spaces as selection items for a multiselect menu, only including spaces the user is a member of.

  • This data source is exclusively for Google Chat apps and is not available for Google Workspace add-ons.

  • ThesetDefaultToCurrentSpace method allows the current Google Chat space to be selected as an item by default in the multiselect menu when set totrue.

ChatSpaceDataSource

A data source that populates Google Chat spaces as selection items for a multiselect menu. Onlypopulates spaces that the user is a member of.

constchatSpaceDataSource=CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);

Only available for Google Chat apps. Not available for Google Workspace add-ons.

Methods

MethodReturn typeBrief description
setDefaultToCurrentSpace(defaultToCurrentSpace)ChatSpaceDataSourceIf set totrue, the multi select menu selects the current Google Chat space as an itemby default.

Detailed documentation

setDefaultToCurrentSpace(defaultToCurrentSpace)

If set totrue, the multi select menu selects the current Google Chat space as an itemby default.

constchatSpaceDataSource=CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);
Only available for Google Chat apps. Not available for Google Workspace add-ons.

Parameters

NameTypeDescription
defaultToCurrentSpaceBooleanThe boolean to be set.

Return

ChatSpaceDataSource — This object, for chaining.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-03 UTC.