0

一旦用户登录到他的 Google 帐户,我正在尝试找到某种方法从 Google 网站中的 google 应用程序脚本小工具的控制面板中检索信息。

我找到了一种以用户身份运行脚本的方法,并使用了函数Session.getActiveUser()并将其部署在应用程序脚本小工具中。

没有工作,并出现错误“脚本运行良好,但没有返回任何内容。”

这个问题有什么解决方案吗?还是我错过了其他显示所需信息的好方法?

4

1 回答 1

1

正如我在评论中提到的,您没有返回 UiApp 对象。有关如何显示 UI 的信息,请参阅Ui 服务文档。在非常基本的级别上,您可以使用以下代码

function doGet(e) 
{
 var app = UiApp.createApplication();
 var value = logActiveUserEmail();
 app.add(app.createLabel('Your email address is ' + value));

 // Return the UI App
 return app; 
} 

function logActiveUserEmail() 
{
 var email = Session.getActiveUser().getEmail();
 Logger.log(email); 
 return email;
}
于 2013-05-19T16:28:41.733 回答