Class Service

服务

访问和操纵脚本发布。

方法

方法返回类型简介
getUrl()String如果 Web 应用已部署,则返回其网址;否则返回 null
isEnabled()Boolean如果脚本可以作为 Web 应用访问,则返回 true

详细文档

getUrl()

如果 Web 应用已部署,则返回其网址;否则返回 null。如果您运行的是开发模式 Web 应用,此方法会返回开发模式网址。

// Mail the URL of the published web app.
MailApp.sendMail(
    'myself@example.com',
    'My Snazzy App',
    `My new app is now available at ${ScriptApp.getService().getUrl()}`,
);

返回

String - Web 应用的网址。


isEnabled()

如果脚本可以作为 Web 应用访问,则返回 true

返回

Boolean - 如果脚本已发布为 Web 应用,则为 true;否则为 false

已弃用的方法