gpt4 book ai didi

java - 获取错误消息 "message": "Invalid Value" when I use google drive api to search a specific file

转载 作者:行者123 更新时间:2023-11-30 05:37:49 24 4
gpt4 key购买 nike

我正在尝试使用 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: ."
}

最佳答案

"File not found: ."

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

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

关于java - 获取错误消息 "message": "Invalid Value" when I use google drive api to search a specific file,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56261700/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com