Użytkownik powiązany z plikiem na Dysku Google. Użytkownicy mogą uzyskiwać dostęp do File.getEditors(), Folder.getViewers() i innych metod.
// Log the email address of all users who have edit access to a file. const file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); const editors = file.getEditors(); for (let i = 0; i < editors.length; i++) { Logger.log(editors[i].getEmail()); }
Metody
| Metoda | Zwracany typ | Krótki opis |
|---|---|---|
get | String|null | Pobiera nazwę domeny powiązaną z kontem użytkownika. |
get | String|null | Pobiera adres e-mail użytkownika. |
get | String|null | Pobiera nazwę użytkownika. |
get | String|null | Pobiera adres URL zdjęcia użytkownika. |
Szczegółowa dokumentacja
get Domain()
Pobiera nazwę domeny powiązaną z kontem użytkownika.
// Log the domain names associated with all users who have edit access to a // file. const file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); const editors = file.getEditors(); for (let i = 0; i < editors.length; i++) { Logger.log(editors[i].getDomain()); }
Powrót
String|null – nazwa domeny powiązana z kontem użytkownika.
get Email()
Pobiera adres e-mail użytkownika. Adres e-mail użytkownika jest dostępny tylko wtedy, gdy użytkownik zdecyduje się udostępnić go na stronie ustawień konta Google+ lub gdy użytkownik należy do tej samej domeny co użytkownik uruchamiający skrypt, a administrator domeny zezwoli wszystkim użytkownikom w domenie na wyświetlanie adresów e-mail innych użytkowników.
// Log the email address of all users who have edit access to a file. const file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); const editors = file.getEditors(); for (let i = 0; i < editors.length; i++) { Logger.log(editors[i].getEmail()); }
Powrót
String|null – adres e-mail użytkownika lub pusty ciąg znaków, jeśli adres e-mail jest niedostępny.
get Name()
Pobiera nazwę użytkownika. Jeśli nazwa użytkownika jest niedostępna, ta metoda zwraca null.
// Log the names of all users who have edit access to a file. const file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); const editors = file.getEditors(); for (let i = 0; i < editors.length; i++) { Logger.log(editors[i].getName()); }
Powrót
String|null – imię i nazwisko użytkownika lub null, jeśli nie są dostępne.
get Photo Url()
Pobiera adres URL zdjęcia użytkownika. Jeśli zdjęcie użytkownika jest niedostępne, ta metoda zwraca wartość null.
// Log the URLs for the photos of all users who have edit access to a file. const file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); const editors = file.getEditors(); for (let i = 0; i < editors.length; i++) { Logger.log(editors[i].getPhotoUrl()); }
Powrót
String|null – adres URL zdjęcia użytkownika lub null, jeśli zdjęcie nie jest dostępne.