Lee*_*e S 6 google-sites google-apps-script
我有一个在 Google 网站上运行的 Google 应用程序脚本项目。该站点需要用户登录,并且只对这个 G-suite 域中的用户开放。
我拥有的脚本用于允许用户进行投票、进入演讲者队列以及其他一些任务。
目前,后台的所有功能都可以正常运行为我更喜欢的“我”,但是我需要知道运行脚本的用户的电子邮件地址(查看 Google 站点)。有什么方法可以让我在以我的身份运行实际脚本的同时获取查看正在运行脚本的页面的登录用户的电子邮件地址?
如果没有,我可以让一个脚本以用户身份运行,然后调用另一个以我身份运行的脚本吗?
Obl*_*lla 10
你试过记录这些吗? https://developers.google.com/apps-script/reference/base/session#getActiveUser()
// Log the email address of the user under whose authority the script is running.
var email = Session.getEffectiveUser().getEmail();
Logger.log(email);
Run Code Online (Sandbox Code Playgroud)
// Log the email address of the person running the script.
var email = Session.getActiveUser().getEmail();
Logger.log(email);
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
11351 次 |
最近记录: |