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)
הגדרת מקור הנתונים מ-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.
פרמטרים
חזרה
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.
פרמטרים
חזרה
PlatformDataSource
– האובייקט הזה, לצורך קישור.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003e\u003ccode\u003ePlatformDataSource\u003c/code\u003e is used to populate items in a multiselect menu for a \u003ccode\u003eSelectionInput\u003c/code\u003e widget within Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt allows developers to set data sources from Google Workspace using \u003ccode\u003esetCommonDataSource\u003c/code\u003e such as Users.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can also use \u003ccode\u003esetHostAppDataSource\u003c/code\u003e to populate spaces in the multiselect menu.\u003c/p\u003e\n"],["\u003cp\u003eThis functionality is exclusive to Google Chat apps and is not available for Google Workspace Add-ons.\u003c/p\u003e\n"]]],[],null,["# Class PlatformDataSource\n\nPlatformDataSource\n\nFor a [SelectionInput](/apps-script/reference/card-service/selection-input) widget that uses a multiselect menu, a data source from Google\nWorkspace. Used to populate items in a multiselect menu.\n\n```javascript\nconst platformDataSource =\n CardService.newPlatformDataSource().setCommonDataSource(\n CardService.CommonDataSource.USER,\n );\n\nconst multiSelect = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.MULTI_SELECT)\n .setFieldName('contacts')\n .setTitle('Selected contacts')\n .setMultiSelectMaxSelectedItems(5)\n .setMultiSelectMinQueryLength(1)\n .setPlatformDataSource(platformDataSource);\n```\n\nOnly available for Google Chat apps. Not available for Google Workspace add-ons. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------------------------------|-------------------------|----------------------------------------------|\n| [setCommonDataSource(commonDataSource)](#setCommonDataSource(CommonDataSource)) | [PlatformDataSource](#) | Sets the data source from Google Workspace. |\n| [setHostAppDataSource(hostAppDataSource)](#setHostAppDataSource(HostAppDataSource)) | [PlatformDataSource](#) | Used to populate spaces in multiselect menu. |\n\nDetailed documentation\n----------------------\n\n### `set``Common``Data``Source(commonDataSource)`\n\nSets the data source from Google Workspace.\n\n```javascript\nconst platformDataSource =\n CardService.newPlatformDataSource().setCommonDataSource(\n CardService.CommonDataSource.USER,\n );\n\nconst multiSelect = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.MULTI_SELECT)\n .setFieldName('contacts')\n .setTitle('Selected contacts')\n .setMultiSelectMaxSelectedItems(5)\n .setMultiSelectMinQueryLength(1)\n .setPlatformDataSource(platformDataSource);\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n#### Parameters\n\n| Name | Type | Description |\n|------------------------|----------------------------------------------------------------------------|----------------------------|\n| `common``Data``Source` | [CommonDataSource](/apps-script/reference/card-service/common-data-source) | The data source to be set. |\n\n#### Return\n\n\n[PlatformDataSource](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Host``App``Data``Source(hostAppDataSource)`\n\nUsed to populate spaces in multiselect menu.\n\n```javascript\nconst chatSpaceDataSource =\n CardService.newChatSpaceDataSource().setDefaultToCurrentSpace(true);\n\nconst chatClientDataSource =\n CardService.newChatClientDataSource().setSpaceDataSource(\n chatSpaceDataSource);\n\nconst hostAppDataSource =\n CardService.newHostAppDataSource().setChatDataSource(chatClientDataSource);\n\nconst platformDataSource =\n CardService.newPlatformDataSource().setHostAppDataSource(hostAppDataSource);\n\nconst multiSelect = CardService.newSelectionInput()\n .setType(CardService.SelectionInputType.MULTI_SELECT)\n .setFieldName('contacts')\n .setTitle('Selected contacts')\n .setMultiSelectMaxSelectedItems(5)\n .setMultiSelectMinQueryLength(1)\n .setPlatformDataSource(platformDataSource);\n```\nOnly available for Google Chat apps. Not available for Google Workspace add-ons.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------------------|-------------------------------------------------------------------------------|----------------------------|\n| `host``App``Data``Source` | [HostAppDataSource](/apps-script/reference/card-service/host-app-data-source) | The data source to be set. |\n\n#### Return\n\n\n[PlatformDataSource](#) --- This object, for chaining."]]