问题描述
当我尝试点击为最新的代码测试网络应用程序时,我总是收到此错误消息。在发布对话框中。
但我没有定义任何名为doGet()的函数。
My代码仅为:
函数unreadCount(){
var unreadNum =邮件未读在收件箱中:+ GmailApp。 getInboxUnreadCount();
return unreadNum
}
Google Apps脚本中的每个web应用程序都必须有一个名为doGet()的主函数,它是应用程序的入口点,当您键入webapp url时,您的应用程序将以此函数开始。
对于作为独立应用程序部署并通过其url调用的每个应用程序而言,这是正确的 - 使用用户界面。
如果您阅读文档,我们将看到HTMLService或UiApp的所有独立应用程序示例都有doGet函数。
只有在触发器上运行的容器嵌入式ui脚本或脚本不受此规则的影响。
知道了,你得到的错误信息可能更有意义,不是吗?
I keep getting this error message when I try to click "Test web app for your latest code." in the Publish dialog box.
But I haven't defined any function called doGet().
My code is only:
function unreadCount() {
var unreadNum = "Messages unread in inbox: " + GmailApp.getInboxUnreadCount();
return unreadNum
}
Every webapp in Google Apps Script must have a main function called doGet() which is the entry point of the app, the function that your app will start with when you type the webapp url.
This is true for every application deployed as a standalone app and called by its url - with a user interface or not.
If you read the documentation you'll see that all the standalone apps examples for HTMLService or UiApp have a doGet function.
Only container embedded ui scripts or scripts that run on triggers are not concerned by this rule.
Knowing that, the error message you get is probably more meaningful isn't it ?
这篇关于找不到脚本功能:doGet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!