设置getEmail的许可权以使其适用于同一G Suite域上的用户 [英] Set Permission for getEmail to Work for Users on Same G Suite Domain

查看:133
本文介绍了设置getEmail的许可权以使其适用于同一G Suite域上的用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的脚本,可以在Google表格上编辑单元格时获取用户的电子邮件和日期/时间.运行该脚本时,该脚本有效;但是,当我的G Suite域中的用户运行脚本时,它将返回空白电子邮件.我对此进行了一些搜索,并且知道由onEdit触发时会发生这种情况,但给人的印象是,如果所有用户都在同一个G Suite域中,那么如果由脚本创建者授权,它会起作用.这是我正在运行的代码的示例:

I have a simple script that gets the user email and date/time when a cell is edited on a google sheet. This script works when I run it; however, when a user in my G Suite domain runs the script it returns a blank email. I have searched a bit about this and know that this occurs when triggered by onEdit but was under the impression that it would work if authorized by the script creator when all users are in the same G Suite Domain. Here is an example of the code that I am running:

function onEdit(e) {
    var range = e.range;
    var userName = Session.getActiveUser().getEmail();
    Browser.msgBox(userName);
}

要设置G Suite管理员,我需要做些什么吗?有人可以帮助我为此设置权限吗?

Is there something that I need to do as the G Suite Admin to set up? Can someone help me set the authorization for this to work?

推荐答案

通常,在触发的事件上无法检索用户的电子邮件地址.用户必须手动单击某些内容.如果您拥有G Suite帐户,则此规则不适用.

In general, a user's email address can not be retrieved on a triggered event. The user must manually click something. If you have a G Suite account, this rule does not apply.

Google文档

这篇关于设置getEmail的许可权以使其适用于同一G Suite域上的用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆