google-drive-api - Google Drive API Search for folders
问题描述
I am trying to get a list of folders so that I can do a search for files within all subfolders. I am using this post (alternative 3) as a reference https://stackoverflow.com/a/41741521/1485815
My query is like this (I have tried mimetype and mimeType in the query)
$optParams = array(
'pageSize' => 1000
,'fields' => 'nextPageToken, files(contentHints/thumbnail,fileExtension,iconLink,id,name,size,thumbnailLink,webContentLink,webViewLink,mimeType,parents, kind, trashed, owners, modifiedTime)'
,'q' => "mimeType=application/vnd.google-apps.folder"
);
$service = new \Google_Service_Drive($this->GoogleClient);
$results = $service->files->listFiles($optParams);
I am authenticated fine, but this query gives an error with the following details
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"
}
],
"code": 400,
"message": "Invalid Value"
}
}
解决方案
- 您想使用带有 PHP 的 googleapis 从 Google Drive 中检索文件夹列表。
- 您已经能够使用 Drive API。
- 你想知道你的问题的原因
Invalid Value
。
修改后的脚本:
从:,'q' => "mimeType=application/vnd.google-apps.folder"
至:
,'q' => "mimeType='application/vnd.google-apps.folder'"
或者
,'q' => 'mimeType="application/vnd.google-apps.folder"'
'
请用和括起 mimeType 的值"
。
参考:
推荐阅读
- javascript - Loop that will run 20 times for array with two entries
- node.js - 如何生成电子生成器 NSIS 块图?可以控制吗?
- ios - 表格单元格中的按钮在点击时不起作用
- java - 为什么Spring App在使用@autowire时会崩溃
- c# - 如何通过 C# 使用 OpenXML 从 Word(.Docx) 中提取 OLE 文件
- sql-server - ALTER PROCEDURE 在 IF 语句中不起作用
- php - 我无法在 php 页面上查看数据库内容
- css - 如何内联定义伪元素样式?
- c++ - 共享库的不同版本之间有什么区别?
- javascript - 基于下拉值的Angular 8 ngIf表达式