Google apps script Google脚本:无法引用使用Session.getActiveUser()的用户
我有一个像我一样执行的谷歌脚本。 在脚本中,我想知道用户的电子邮件。 因此,我将访问我的应用程序的用户的电子邮件称为Session.getActiveUser().getEmail() 那根本行不通。Google脚本出现错误,表示Session.getActiveUser().getEmail()为空 当我手动输入一封伪电子邮件而不是Session.getActiveUser().getEmail()时,代码工作得非常好 HeeeelpGoogle apps script Google脚本:无法引用使用Session.getActiveUser()的用户,google-apps-script,authentication,Google Apps Script,Authentication,我有一个像我一样执行的谷歌脚本。 在脚本中,我想知道用户的电子邮件。 因此,我将访问我的应用程序的用户的电子邮件称为Session.getActiveUser().getEmail() 那根本行不通。Google脚本出现错误,表示Session.getActiveUser().getEmail()为空 当我手动输入一封伪电子邮件而不是Session.getActiveUser().getEmail()时,代码工作得非常好 Heeeelp PS:应用程序必须以我的身份执行,因为它需要访问我的联系人
PS:应用程序必须以我的身份执行,因为它需要访问我的联系人。当应用程序以您的身份运行时,您不能让
会话。getActiveUser().getEmail()
返回用户的电子邮件id。您可以尝试一些变通方法
function whatever(){
UrlFetchApp.fetch('SERVICE_URL_OF_SCRIPT_2');
}
脚本2:
function doGet(e){
// code to access your contact, get parameters in e.parameters
}
我有:function which(){//UI元素,handler,etc return app}function doGet(e){//call e.parameter.textbox,尝试检索Session.getActiveUser().getEmail()},我确信文档中说活动用户就是当前在键盘上的人,而有效用户是指web应用程序在其权限下运行的用户。只需按照我的建议,将这两个功能拆分为不同的脚本,并使用UrlFetch将它们绑定在一起。抱歉,伙计,你的答案没有回答我的问题。脚本必须以我的身份运行。否则,它会对最终用户造成太大的侵害。