Search for files (with conditions) in the Google Drive SDK using Java -


i'm trying search files in drive java, i'm not sure how set conditions. example given in video tutorial in python. so, here method retrieve list of files drive:

private static list<file> retrieveallfiles(drive service) throws ioexception {     list<file> result = new arraylist<file>();     files.list request = service.files().list();      {          try {             filelist files = request.execute();             result.addall(files.getitems());             request.setpagetoken(files.getnextpagetoken());             } catch (ioexception e) {                 system.out.println("an error occurred: " + e);                 request.setpagetoken(null);             }     } while (request.getpagetoken() != null &&             request.getpagetoken().length() > 0);      return result; } 

now, mention here file.list method accepts q parameter. how can that? when try set parameter examples given in video q = "title contains 'fruit'", not work. doing wrong? request.queue() used this?

thanks

use setq method files list request.

https://developers.google.com/resources/api-libraries/documentation/drive/v2/java/latest/com/google/api/services/drive/drive.files.list.html#setq(java.lang.string)

for examples on how query files/folders:

https://developers.google.com/drive/web/search-parameters#examples


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -