[英]Get List of All Folders In Google Drive - Google Drive API
[英]List all folders that are direct children Google drive API
我正在嘗試使用 google api php 客戶端列出位於 teamdrive 根目錄下的所有文件夾。 我使用的 perans 看起來像這樣:
$optParams = array(
'driveId' => "<ID OF TEAM DRIVE>",
'pageSize' => 100,
'includeItemsFromAllDrives' => true,
'supportsAllDrives' => true,
'corpora' => "drive",
'fields'=>'nextPageToken, files(id, name)',
'q' => ["mimeType = 'application/vnd.google-apps.folder'", "'<ID OF TEAM DRIVE>' in parents"]
);
問題是這也列出了所有子文件夾,而不僅僅是該團隊驅動器根目錄中的文件夾。
這感覺應該很容易,但我可能遺漏了一些明顯的東西。
我確實通過刪除 DriveId、copora 和 mimeType 解決了這個問題。 我的猜測是這個聲明(我沒有找到文檔)意味着一件事或另一件事,而不是一件事和另一件事。
["mimeType = 'application/vnd.google-apps.folder'", "'<ID OF TEAM DRIVE>' in parents"]
所以對我有用的是:
$optParams = array(
'pageSize' => 100,
'includeItemsFromAllDrives' => true,
'supportsAllDrives' => true,
'fields'=>'nextPageToken, files(id, name)',
'q' => "'<DRIVE ID>' in parents"
);
user3477740 ,你非常親密。
將整個查詢放在一個字符串中,如下所示,並且(我強烈建議)將您的邏輯分隔在括號內:
'q' => "(trashed = false) and (mimeType = 'application/vnd.google-apps.folder') and ('<DRIVE ID>' in parents)"
感謝您向我展示了在 google drive 文件夾中引用 google drive children 的簡單方法——它在 Google Drive V3 中沒有很好的記錄
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.