更新时间:2023-02-14 14:28:15
意思是(1)身份证是错误的,或者(2)你没有权限访问该文件夹。
要确认ID,请使用 https://developers.google.com/drive/v2/reference/files/get#try-it 并查看是否可以检索该文件。
如果可行,请检查您的应用使用的用户和范围是否允许访问。
I'm trying to get all the files / folders from a parent folder.
I managed to get the ID of the parent folder. When I try to get the file information, I can, if I Use the ID as indicated on this page live example : https://developers.google.com/drive/v2/reference/files/get
However, when I try to get any file data with the page code sample :
try {
File file = service.files().get(fileId).execute();
System.out.println("Title: " + file.getTitle());
System.out.println("Description: " + file.getDescription());
System.out.println("MIME type: " + file.getMimeType());
} catch (IOException e) {
System.out.println("An error occured: " + e);
}
}
I get nothing, except get this error message :
com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 OK
{
"code" : 404,
"errors" : [ {
"domain" : "global",
"message" : "File not found: 0Bz8fRNYAOdjjd05ydVRCROE4QlE",
"reason" : "notFound"
} ],
"message" : "File not found: 0Bz8fRNYAOdjjd05ydVRCROE4QlE"
}
How could I get any data from the file / folder with its ID?
Thank you very much in advance and greetings !
404 means either (1) the ID is wrong, or (2) you don't have permission to access that folder.
To confirm the ID, use Try It at https://developers.google.com/drive/v2/reference/files/get#try-it and see if the file can be retrieved.
If this works, check that the user and scope that your app is using allow access.