Google Drive SDK API does not lists the file uploaded by Google Drive in java -
i creating application can insert files google drive , lists it. using google drive sdk v2 api. problem is not listing files not uploaded through application. if upload directly google drive not listed in application.
here method list file:
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; }
and iterating files :
list<file> files = retrieveallfiles(service); for(file f : files) { system.out.println("file name : "+f.getoriginalfilename(); }
can me please ? in advance ...
i think using wrong oauth scope, https://www.googleapis.com/auth/drive.file
restrict app's access file created or opened app, when should use https://www.googleapis.com/auth/drive
gives full control app.
Comments
Post a Comment