Konto użytkownika powiązane z plikiem na Dysku Google. Dostęp użytkowników można uzyskać za pomocą File.getEditors()
, Folder.getViewers()
i innych metod.
// Log the email address of all users who have edit access to a file. var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); var editors = file.getEditors(); for (var i = 0; i < editors.length; i++) { Logger.log(editors[i].getEmail()); }
Metody
Metoda | Zwracany typ | Krótki opis |
---|---|---|
getDomain() | String | Pobiera nazwę domeny powiązaną z kontem użytkownika. |
getEmail() | String | Pobiera adres e-mail użytkownika. |
getName() | String | Pobiera nazwę użytkownika. |
getPhotoUrl() | String | Pobiera adres URL zdjęcia użytkownika. |
Szczegółowa dokumentacja
getDomain()
Pobiera nazwę domeny powiązaną z kontem użytkownika.
// Log the domain names associated with all users who have edit access to a file. var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); var editors = file.getEditors(); for (var i = 0; i < editors.length; i++) { Logger.log(editors[i].getDomain()); }
Powroty
String
– nazwa domeny powiązana z kontem użytkownika
getEmail()
Pobiera adres e-mail użytkownika. Adres e-mail użytkownika jest dostępny tylko wtedy, gdy na stronie ustawień konta Google+ został udostępniony lub jeśli 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. var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); var editors = file.getEditors(); for (var i = 0; i < editors.length; i++) { Logger.log(editors[i].getEmail()); }
Powroty
String
– adres e-mail użytkownika lub pusty ciąg, jeśli adres jest niedostępny;
getName()
Pobiera nazwę użytkownika. Ta metoda zwraca wartość null
, jeśli nazwa użytkownika jest niedostępna.
// Log the names of all users who have edit access to a file. var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); var editors = file.getEditors(); for (var i = 0; i < editors.length; i++) { Logger.log(editors[i].getName()); }
Powroty
String
– nazwa użytkownika lub null
, jeśli nazwa jest niedostępna;
getPhotoUrl()
Pobiera adres URL zdjęcia użytkownika. Ta metoda zwraca wartość null
, jeśli zdjęcie użytkownika jest niedostępne.
// Log the URLs for the photos of all users who have edit access to a file. var file = DriveApp.getFileById('1234567890abcdefghijklmnopqrstuvwxyz'); var editors = file.getEditors(); for (var i = 0; i < editors.length; i++) { Logger.log(editors[i].getPhotoUrl()); }
Powroty
String
– adres URL zdjęcia użytkownika lub null
, jeśli zdjęcie jest niedostępne;