Google ドライブのファイルに関連付けられているユーザー。ユーザーには、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()); }
メソッド
| メソッド | 戻り値の型 | 概要 |
|---|---|---|
get | String|null | ユーザーのアカウントに関連付けられているドメイン名を取得します。 |
get | String|null | ユーザーのメールアドレスを取得します。 |
get | String|null | ユーザーの名前を取得します。 |
get | String|null | ユーザーの写真の URL を取得します。 |
詳細なドキュメント
get Domain()
ユーザーのアカウントに関連付けられているドメイン名を取得します。
// 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|null - ユーザーのアカウントに関連付けられたドメイン名
get Email()
ユーザーのメールアドレスを取得します。ユーザーのメールアドレスは、ユーザーが 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|null - ユーザーのメールアドレス。メールアドレスが利用できない場合は空の文字列
get Name()
ユーザーの名前を取得します。ユーザー名が利用できない場合、このメソッドは 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 - ユーザーの名前。名前が利用できない場合は null
get Photo Url()
ユーザーの写真の 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|null - ユーザーの写真の URL。写真がない場合は null