如果 Selection 小工具使用多選選單,則資料來源必須來自 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 Chat 應用程式。不適用於 Google Workspace 外掛程式。
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
set | Platform | 設定 Google Workspace 的資料來源。 |
set | Platform | 從 Google Workspace 設定雲端硬碟資料來源規格。 |
set | Platform | 用於在多選選單中填入空格。 |
內容詳盡的說明文件
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);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
common | Common | 要設定的資料來源。 |
回攻員
Platform - 這個物件,用於鏈結。
set Drive Data Source Spec(driveDataSourceSpec)
從 Google Workspace 設定雲端硬碟資料來源規格。
const driveDataSourceSpec = CardService.newDriveDataSourceSpec() .addItemType(CardService.DriveItemType.DOCUMENTS) .addItemType(CardService.DriveItemType.FORMS); const platformDataSource = CardService.newPlatformDataSource().setCommonDataSource( CardService.CommonDataSource.DRIVE ).setDriveDataSourceSpec(driveDataSourceSpec); const multiSelect = CardService.newSelectionInput() .setType(CardService.SelectionInputType.MULTI_SELECT) .setFieldName('files') .setTitle('Drive Files') .setMultiSelectMaxSelectedItems(5) .setMultiSelectMinQueryLength(1) .setPlatformDataSource(platformDataSource);
https://www.googleapis.com/auth/drive.file)。參數
| 名稱 | 類型 | 說明 |
|---|---|---|
drive | Drive | 要設定的雲端硬碟資料來源規格。 |
回攻員
Platform - 這個物件,用於鏈結。
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);
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
host | Host | 要設定的資料來源。 |
回攻員
Platform - 這個物件,用於鏈結。