Set Permission for getEmail to Work for Users on Same G Suite Domain

别来无恙 提交于 2020-04-17 21:43:24

问题


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);
}

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?


回答1:


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 Documentation



来源:https://stackoverflow.com/questions/58664414/set-permission-for-getemail-to-work-for-users-on-same-g-suite-domain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!