Class User
Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Kullanıcı
Komut dosyası yazmaya uygun bir kullanıcı temsili.
Yöntemler
Yöntem | Dönüş türü | Kısa açıklama |
getEmail() | String | Kullanıcının e-posta adresini (varsa) alır. |
Kullanımdan kaldırılan yöntemler
Yöntem | Dönüş türü | Kısa açıklama |
getUserLoginId()
| String | Kullanıcının e-posta adresini alır. |
Ayrıntılı dokümanlar
getEmail()
Kullanıcının e-posta adresini (varsa) alır. Güvenlik politikaları kullanıcının e-posta adresine erişime izin vermiyorsa bu yöntem boş bir dize döndürür. E-posta adresinin kullanılabildiği durumlar değişiklik gösterir: Örneğin, kullanıcının e-posta adresi, bir komut dosyasının kullanıcının yetkilendirmesi olmadan çalışmasına izin veren herhangi bir bağlamda kullanılamaz (ör. basit bir onOpen(e)
veya onEdit(e)
tetikleyici, Google E-Tablolar'daki özel bir işlev ya da "benim adıma çalıştır" (yani kullanıcı yerine geliştirici tarafından yetkilendirilmiş) olarak dağıtılan bir web uygulaması).
Ancak geliştirici komut dosyasını kendisi çalıştırırsa veya kullanıcıyla aynı Google Workspace alanına aitse bu kısıtlamalar genellikle geçerli olmaz.
// Log the email address of the person running the script.
Logger.log(Session.getActiveUser().getEmail());
Return
String
: Kullanıcının e-posta adresi veya güvenlik politikaları kullanıcının e-posta adresine erişime izin vermiyorsa boş bir dize.
Kullanımdan kaldırılan yöntemler
getUserLoginId()
Kullanımdan kaldırıldı. 24 Haziran 2013 itibarıyla getEmail()
ile değiştirildi.
Kullanıcının e-posta adresini alır.
// Log the email address of the person running the script.
Logger.log(Session.getActiveUser().getUserLoginId());
Return
String
: Kullanıcının e-posta adresi.
Aksi belirtilmediği sürece bu sayfanın içeriği Creative Commons Atıf 4.0 Lisansı altında ve kod örnekleri Apache 2.0 Lisansı altında lisanslanmıştır. Ayrıntılı bilgi için Google Developers Site Politikaları'na göz atın. Java, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-07-26 UTC.
[null,null,["Son güncelleme tarihi: 2025-07-26 UTC."],[[["\u003cp\u003eRepresents a user for scripting purposes, providing methods to access user information.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetEmail()\u003c/code\u003e retrieves the user's email address if permitted by security policies, returning a blank string otherwise.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003egetUserLoginId()\u003c/code\u003e is deprecated and replaced by \u003ccode\u003egetEmail()\u003c/code\u003e for retrieving the user's email address.\u003c/p\u003e\n"],["\u003cp\u003eAccess to the user's email address might be restricted in certain contexts due to security considerations, such as unauthorized script execution.\u003c/p\u003e\n"]]],[],null,["# Class User\n\nUser\n\nRepresentation of a user, suitable for scripting. \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------|-------------|----------------------------------------------|\n| [getEmail()](#getEmail()) | `String` | Gets the user's email address, if available. |\n\n### Deprecated methods\n\n| Method | Return type | Brief description |\n|---------------------------------------|-------------|--------------------------------|\n| [getUserLoginId()](#getUserLoginId()) | `String` | Gets the user's email address. |\n\nDetailed documentation\n----------------------\n\n### `get``Email()`\n\nGets the user's email address, if available. If security policies do not allow access to the\nuser's email address, this method returns a blank string. The circumstances in which the email\naddress is available vary: for example, the user's email address is not available in any\ncontext that allows a script to run without that user's authorization, like a simple `on``Open(e)` or `on``Edit(e)` trigger, a custom function in Google Sheets, or a web app\ndeployed to \"execute as me\" (that is, authorized by the developer instead of the user).\nHowever, these restrictions generally do not apply if the developer runs the script themselves\nor belongs to the same Google Workspace domain as the user.\n\n```javascript\n// Log the email address of the person running the script.\nLogger.log(Session.getActiveUser().getEmail());\n```\n\n#### Return\n\n\n`String` --- The user's email's address, or a blank string if security policies do not allow access\nto the user's email address.\n\nDeprecated methods\n------------------\n\n### `get``User``Login``Id()`\n\n\n**Deprecated.** As of June 24, 2013, replaced by [getEmail()](#getEmail()).\n\nGets the user's email address.\n\n```javascript\n// Log the email address of the person running the script.\nLogger.log(Session.getActiveUser().getUserLoginId());\n```\n\n#### Return\n\n\n`String` --- The user's email's address."]]