Class User

사용자

Google Drive의 파일과 연결된 사용자입니다. 사용자는 File.getEditors(), Folder.getViewers(), 기타 메서드에서 액세스할 수 있습니다.

// 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());
}

메서드

메서드반환 유형간략한 설명
getDomain()String사용자 계정과 연결된 도메인 이름을 가져옵니다.
getEmail()String사용자의 이메일 주소를 가져옵니다.
getName()String사용자의 이름을 가져옵니다.
getPhotoUrl()String사용자 사진의 URL을 가져옵니다.
메서드반환 유형간략한 설명
getUserLoginId()String사용자의 이메일 주소를 가져옵니다.

자세한 문서

getDomain()

사용자 계정과 연결된 도메인 이름을 가져옵니다.

// 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());
}

리턴

String: 사용자 계정과 연결된 도메인 이름


getEmail()

사용자의 이메일 주소를 가져옵니다. 사용자의 이메일 주소는 사용자가 Google+ 계정 설정 페이지에서 주소를 공유하도록 선택한 경우 또는 사용자가 스크립트를 실행하는 사용자와 동일한 도메인에 속해 있고 도메인 관리자가 도메인 내 모든 사용자가 다른 사용자의 이메일 주소를 볼 수 있도록 허용한 경우에만 사용할 수 있습니다.

// 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());
}

리턴

String: 사용자의 이메일 주소 또는 이메일 주소를 사용할 수 없는 경우 빈 문자열


getName()

사용자의 이름을 가져옵니다. 사용자 이름을 사용할 수 없는 경우 이 메서드는 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());
}

리턴

String: 사용자의 이름 또는 이름을 사용할 수 없는 경우 null


getPhotoUrl()

사용자 사진의 URL을 가져옵니다. 이 메서드는 사용자의 사진을 사용할 수 없는 경우 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());
}

리턴

String: 사용자 사진의 URL입니다. 사진을 사용할 수 없는 경우 null입니다.

지원 중단된 메서드

지원 중단되었습니다. 2013년 6월 24일부터 getEmail()로 대체되었습니다.

사용자의 이메일 주소를 가져옵니다.

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

리턴

String: 사용자의 이메일 주소입니다.