Stay organized with collections Save and categorize content based on your preferences.
UserRepresentation of a user, suitable for scripting.
Methods Method Return type Brief descriptiongetEmail()
String
Gets the user's email address, if available. Deprecated methods Method Return type Brief description getUserLoginId()
String
Gets the user's email address. Detailed documentation getEmail()
Gets the user's email address, if available. If security policies do not allow access to the user's email address, this method returns a blank string. The circumstances in which the email address is available vary: for example, the user's email address is not available in any context that allows a script to run without that user's authorization, like a simple onOpen(e)
or onEdit(e)
trigger, a custom function in Google Sheets, or a web app deployed to "execute as me" (that is, authorized by the developer instead of the user). However, these restrictions generally do not apply if the developer runs the script themselves or belongs to the same Google Workspace domain as the user.
// Log the email address of the person running the script. Logger.log(Session.getActiveUser().getEmail());Return
String
— The user's email's address, or a blank string if security policies do not allow access to the user's email address.
getUserLoginId()
Deprecated. As of June 24, 2013, replaced by getEmail()
.
Gets the user's email address.
// Log the email address of the person running the script. Logger.log(Session.getActiveUser().getUserLoginId());Return
String
— The user's email's address.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-12-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-02 UTC."],[[["Represents a user for scripting purposes, providing methods to access user information."],["`getEmail()` retrieves the user's email address if permitted by security policies, returning a blank string otherwise."],["`getUserLoginId()` is deprecated and replaced by `getEmail()` for retrieving the user's email address."],["Access to the user's email address might be restricted in certain contexts due to security considerations, such as unauthorized script execution."]]],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4