从Google云端硬盘中的ID文件夹获取儿童文件 [英] Get childrens files from an ID folder in Google Drive

查看:200
本文介绍了从Google云端硬盘中的ID文件夹获取儿童文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从父文件夹中获取所有文件/文件夹。



我设法获取父文件夹的ID。当我尝试获取文件信息时,如果使用此页面上显示的ID,则可以使用此ID: https://developers.google.com/drive/v2/reference/files/get



但是,当我尝试使用页面代码示例获取任何文件数据:

  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(发生错误:+ e);




$ b我没有任何东西,除了得到这个错误信息:



$ b> / p>

com.google.api.client.googleapis.json.GoogleJsonResponseException:404确定

 code:404,
errors:[{
domain:global,
message:File not found: 0Bz8fRNYAOdjjd05ydVRCROE4QlE,
reason:notFound
}],
message:File not found:0Bz8fRNYAOdjjd05ydVRCROE4QlE
}


我怎样才能从文件/文件夹中获得任何数据和它的ID?




解决方案

<404>意思是(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.

这篇关于从Google云端硬盘中的ID文件夹获取儿童文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆