Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shikumiya-hata/0570f904d5d1debb1610b7a38d77de23 to your computer and use it in GitHub Desktop.
Save shikumiya-hata/0570f904d5d1debb1610b7a38d77de23 to your computer and use it in GitHub Desktop.
/**
* 共有ドライブ名から共有ドライブを取得
* @param {string} teamDriveName - 共有ドライブ名
* @return {TeamDrive} - 共有ドライブ
*/
function getByName(teamDriveName) {
// 共有ドライブのリストから一致する名前を検索(オプション使用)
const teamDrives = Drive.Teamdrives.list({q: "name contains '"+teamDriveName+"'", useDomainAdminAccess:true}).items
return teamDrives[0]
/*
// 共有ドライブのリストから一致する名前を検索(オプションなし)
const teamDrives = Drive.Teamdrives.list().items
for (var i in teamDrives) {
var teamDrive = teamDrives[i]
if (teamDrive.name === teamDriveName) {
return teamDrive
}
}
*/
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment