【问题标题】:Getting the error message "message" : "Invalid Value" when I use google drive api to search a specific file当我使用 google drive api 搜索特定文件时收到错误消息“消息”:“无效值”
【发布时间】:2019-10-09 05:31:18
【问题描述】:

我正在尝试使用 java Google Drive API 查找文件夹的子文件夹

for (com.google.api.services.drive.model.File file : result.getFiles()) {
     System.out.printf("Found file: %s (%s)\n", file.getName(), file.getId());

     String fileId =file.getId();

     FileList childern =  service.files().list().setQ(" 'fileId' in parents").execute();
     }

这里不是硬编码我动态获取的文件 ID 的值。

Error msg:
{
  "code" : 404,
  "errors" : [ {
    "domain" : "global",
    "location" : "fileId",
    "locationType" : "parameter",
    "message" : "File not found: .",
    "reason" : "notFound"
  } ],
  "message" : "File not found: ."
}

【问题讨论】:

  • 你能添加整个错误代码吗?
  • 添加错误信息

标签: java google-api google-drive-api google-api-java-client


【解决方案1】:

“找不到文件:。”

意味着您要查找的文件 id 不存在。我的 java 不是最好的,但我建议尝试这样的方法来确保正确放置 id。

request.setQ(String.format("'fileId' in parents", fileId));

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-10-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-05-18
    • 2022-06-13
    • 2022-11-19
    相关资源
    最近更新 更多