簡體   English   中英

Google Apps腳本-獲取用戶的電子郵件地址

[英]Google Apps Script - Get users email address

我有一個在Google網站上運行的Google Apps腳本項目。 該網站要求用戶登錄,並且僅向該G-suite域中的用戶開放。

我擁有的腳本用於允許用戶進行投票,進入發言者隊列以及其他一些任務。

當前,后台中的所有功能都可以以“我”的身份正常運行,我更喜歡,但是我需要知道運行腳本的用戶的電子郵件地址(查看Google網站)。 在以我自己運行實際腳本的同時,有什么辦法讓我獲得查看運行腳本頁面的登錄用戶的電子郵件地址?

如果沒有,我可以讓一個腳本作為用戶運行,然后調用另一個像我一樣運行的腳本嗎?

您是否嘗試過記錄這些? 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); 

  // Log the email address of the person running the script. var email = Session.getActiveUser().getEmail(); Logger.log(email); 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM