简体   繁体   English

使用Google Drive API制作Google Drive帐户的数据文件

[英]make a data file of google drive account using google drive api

I'am want to get all of my data in google drive into file (xml or json it's not so matter). 我想将我在Google驱动器中的所有数据都保存到文件中(xml或json没关系)。 the regular way to do it is like this: 常规方法是这样的:

Drive service = new Drive(somedata);
String fileName = service.get(fileId).execute().getTitle();

to get the file id, it's needed to do this: 要获取文件ID,需要执行以下操作:

Children.List request  = service.children().list(root);
ChildList children = request.execute();
String fileId = children.getItems().get(0).getId();

the problem is that the: 问题是:

String fileName = service.get(fileId).execute().getTitle(); 

take very long time for each file. 每个文件花费很长时间。

and if I want to create a data file that contain all my data it's will take a lot of time. 如果我想创建一个包含我所有数据的数据文件,那将花费很多时间。

I need the file name for the presentation of the file system of my google drive account. 我需要用于表示Google驱动器帐户文件系统的文件名。

anyone dealed with it and know waht to do? 有人处理过它并且知道要做什么吗?

Instead of children.list(root) do files.list(q='root' in parents, fields=nextPageToken, items/title) . 而不是children.list(root)files.list(q='root' in parents, fields=nextPageToken, items/title) That way you get all of your titles in a single (paginated) fetch. 这样一来,您就可以通过一次(分页)获取所有标题。

NB. NB。 This is pseudo code. 这是伪代码。 Look at the Java library for the exact syntax 查看Java库以获取确切的语法

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM