Class PlatformDataSource

PlattformDatenQuelle

Für ein SelectionInput-Widget, das ein Menü mit Mehrfachauswahl verwendet, eine Datenquelle aus Google Workspace. Wird verwendet, um Elemente in einem Menü mit Mehrfachauswahl zu füllen.

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);

Nur für Google Chat-Apps verfügbar. Nicht für Google Workspace-Add‑ons verfügbar.

Methoden

MethodeRückgabetypKurzbeschreibung
setCommonDataSource(commonDataSource)PlatformDataSourceLegt die Datenquelle aus Google Workspace fest.
setDriveDataSourceSpec(driveDataSourceSpec)PlatformDataSourceLegt die Spezifikation der Drive-Datenquelle aus Google Workspace fest.
setHostAppDataSource(hostAppDataSource)PlatformDataSourceWird verwendet, um Bereiche im Menü mit Mehrfachauswahl auszufüllen.

Detaillierte Dokumentation

setCommonDataSource(commonDataSource)

Legt die Datenquelle aus Google Workspace fest.

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);
Nur für Google Chat-Apps verfügbar. Nicht für Google Workspace-Add‑ons verfügbar.

Parameter

NameTypBeschreibung
commonDataSourceCommonDataSourceDie festzulegende Datenquelle.

Rückflug

PlatformDataSource: Dieses Objekt zur Verkettung.


setDriveDataSourceSpec(driveDataSourceSpec)

Legt die Spezifikation der Drive-Datenquelle aus Google Workspace fest.

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);
Für Google Chat-Apps verfügbar. Für Google Workspace-Add-ons muss der Zugriffsbereich pro Datei(https://www.googleapis.com/auth/drive.file) in das Manifest aufgenommen werden.

Parameter

NameTypBeschreibung
driveDataSourceSpecDriveDataSourceSpecDie festzulegende Drive-Datenquellen-Spezifikation.

Rückflug

PlatformDataSource: Dieses Objekt zur Verkettung.


setHostAppDataSource(hostAppDataSource)

Wird verwendet, um Bereiche im Menü mit Mehrfachauswahl zu füllen.

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);
Nur für Google Chat-Apps verfügbar. Nicht für Google Workspace-Add‑ons verfügbar.

Parameter

NameTypBeschreibung
hostAppDataSourceHostAppDataSourceDie festzulegende Datenquelle.

Rückflug

PlatformDataSource: Dieses Objekt zur Verkettung.