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.
for examples on how query files/folders:
https://developers.google.com/drive/web/search-parameters#examples
Comments
Post a Comment