我试图找到某种方式在用户登录到他的Google帐户后,从Google网站中的Google应用程序脚本小工具的控制面板中检索信息。在Google应用程序脚本中显示帐户信息
我找到了run the script as the user的一种方法,并使用函数Session.getActiveUser()并将其部署到apps脚本小工具中。
没有工作,出现错误“脚本完美运行,但没有任何回报。”
此问题的任何解决方案?或者我错过了其他一些显示所需信息的好方法吗?
我试图找到某种方式在用户登录到他的Google帐户后,从Google网站中的Google应用程序脚本小工具的控制面板中检索信息。在Google应用程序脚本中显示帐户信息
我找到了run the script as the user的一种方法,并使用函数Session.getActiveUser()并将其部署到apps脚本小工具中。
没有工作,出现错误“脚本完美运行,但没有任何回报。”
此问题的任何解决方案?或者我错过了其他一些显示所需信息的好方法吗?
正如我在我的评论中提到的,你没有返回一个UiApp对象。有关如何显示UI的信息,请参阅Ui Service documentation。在一个非常基本的水平,你可以使用下面的代码
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;
}
哇,我缺乏太多的抱歉我是新来的,感谢有关UIApp的信息,并感谢您的帮助=) –
你可以发布一些代码。看看这个问题,看起来你有一个doGet(),但没有从doGet中返回一个UiApp。 – Srik
'function doGet(e){ var value = logActiveUserEmail(); 返回值; } function logActiveUserEmail(){ var email = Session.getActiveUser()。getEmail(); Logger.log(email); } ' 你去那里 –