java - use google drive api get children without trash -
how can folder's children files without deleted files in trash, code follow:
children children = service.children(); drive.children.list request = children.list("root"); { try { childlist clist = request.execute(); (childreference cr : clist.getitems()) { file file = service.files().get(cr.getid()) .execute(); system.out.println(file.gettitle() + "--"+ file.getmimetype()); } request.setpagetoken(clist.getnextpagetoken()); } catch (ioexception e) { system.out.println("an error occurred: " + e); request.setpagetoken(null); } } while (request.getpagetoken() != null && request.getpagetoken().length() > 0);
use trashed = false
query when listing:
drive.files().list().setq("trashed = false").execute();
more querying options on https://developers.google.com/drive/search-parameters
Comments
Post a Comment