java - Retrieve a list of file resource thru Drive Api -
i using drive api retrieve list of files google drive using java code:
files.list request = services.files().list(); list<file> result = new arraylist<file>(); { try { filelist files = request.execute(); system.out.println("getalternatelink::"+files.getitems().get(0).getalternatelink()); result.addall(files.getitems()); request.setpagetoken(files.getnextpagetoken()); } catch (ioexception e) { log.log(level.warning, "an error occured: ", e); request.setpagetoken(null); } } while (request.getpagetoken() != null && request.getpagetoken().length() > 0);
using getalternatelink method, got this url.
my question how write code '/spreadsheet' location instead of '/file' in url. i.e -
https://docs.google.com/a/test.com/spreadsheet/d/0ivwrm7safgdrv9ruzrrbms/edit?usp=drivesdk
you /spreadsheet url if file google spreadsheet. if general file or ms excel file, /file url.
you can limit query google spreadsheets using mime_type filter "application/vnd.google-apps.spreadsheet"
Comments
Post a Comment