Google Apps Script ドライブ内のファイルのオーナーを取得するサンプル

環境
Google Chrome  122.0.6261.129(Official Build) (64 ビット)
Windows 11 Pro 64bit

構文
file.getOwner()
ファイルのオーナーを取得するには、「getOwner」を使用します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function myFunction() {
// idから取得
let f = DriveApp.getFileById('xxxx_6');
let owner = f.getOwner();
// 名前を取得する
console.log( owner.getName() );
// メールアドレスを取得
console.log( owner.getEmail() );
}
function myFunction() { // idから取得 let f = DriveApp.getFileById('xxxx_6'); let owner = f.getOwner(); // 名前を取得する console.log( owner.getName() ); // メールアドレスを取得 console.log( owner.getEmail() ); }
function myFunction() {

  // idから取得
  let f = DriveApp.getFileById('xxxx_6');

  let owner = f.getOwner();

  // 名前を取得する
  console.log( owner.getName() );
  // メールアドレスを取得
  console.log( owner.getEmail() );

}

 

Google Apps Script

Posted by arkgame