如何使用App Script在Gmail加载项中使用HtmlService [英] How to use HtmlService in Gmail add-on using App Script
问题描述
我正在创建一个Gmail加载项.以下参考页面显示- https://developers.google.com/gmail/add-ons/reference/
I am creating a Gmail Add-on. The following reference page says - https://developers.google.com/gmail/add-ons/reference/
"Gmail附加组件是使用Apps Script及其提供的许多服务构建的.构建附加组件时,您可以使用任何Apps Script服务"
"Gmail add-ons are built using Apps Script and the many services it provides. You can use any of the Apps Script services when building your add-on"
基本上,我希望在单击Gmail加载项中的按钮时弹出小屏幕.
Basically, I want to have the small screen to pop up on clicking a button in my Gmail add-on.
到目前为止,我已经在我的部分中添加了一个按钮,如下所示,并将其绑定到动作处理程序"htmltest":-
As of now I have added a button in my section as follows and tied it to an action handler 'htmltest':-
var htmlTest = CardService.newAction().setFunctionName('htmlTest');
var button = CardService.newTextButton().setText("htmlTest").setOnClickAction(htmlTest);
section.addWidget(button);
这是htmlTest的样子:-
This is how htmlTest looks like:-
function htmlTest(e){
return HtmlService.createHtmlOutputFromFile('doubleCheck');
}
这是我要弹出的doubleCheck.html文件:-
And this is the doubleCheck.html file I want it to pop up:-
<!DOCTYPE html>
<html>
<head>
<base target="_top">
</head>
<body>
Hello, World!
</body>
</html>
但是,当我单击按钮时,它给出了运行时错误: 缺少标记中的必填字段:
But when I click the button it gives a run-time error:- Missing required fields in markup:
任何提示在创建Gmail时如何使用HtmlService
Any clues how to use HtmlService while creating Gmail
推荐答案
在CardService的概述部分中,它引用:
In the overview section of the CardService, It quotes:
目前,您只能使用此服务来构建Gmail插件."
"Currently you can only use this service to construct Gmail add-ons."
因此HtmlService目前无法用于构建Gmail插件.
So HtmlService is not available in constructing Gmail addon’s currently.
https://developers.google.com/apps-script/参考/卡片服务/
这篇关于如何使用App Script在Gmail加载项中使用HtmlService的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!