Class PlatformDataSource

PlatformDataSource

如果 SelectionInput 小工具使用複選選單,則為 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 外掛程式。

方法

方法傳回類型簡短說明
setCommonDataSource(commonDataSource)PlatformDataSource設定來自 Google Workspace 的資料來源。
setHostAppDataSource(hostAppDataSource)PlatformDataSource用於在複選選單中填入空格。

內容詳盡的說明文件

setCommonDataSource(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 Chat 應用程式。不適用於 Google Workspace 外掛程式。

參數

名稱類型說明
commonDataSourceCommonDataSource要設定的資料來源。

回攻員

PlatformDataSource:這個物件用於鏈結。


setHostAppDataSource(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 Chat 應用程式。不適用於 Google Workspace 外掛程式。

參數

名稱類型說明
hostAppDataSourceHostAppDataSource要設定的資料來源。

回攻員

PlatformDataSource:這個物件用於鏈結。