scripting - Exporting a bunch of Google Calendar .ics files, to a folder on Google Drive -


i have several calendars in google account, set periodical back-up.

each calendar has specific export url .ics file, e.g. https://calendar.google.com/calendar/exporticalzip?cexp=insert_long_string_of_characters

i'd take each export link each calendar, , have sort of script export files designated folder on google drive (instead of local machine)

is such thing possible?

thanks!

jamie

to specific export url, can use method 'files:get' file's metadata id. under downloadurl has exportlinks including (key). retrieve appropriate download url provided in file's metadata retrieve actual file content or link using download url.

to download files, make authorized http get request file's resource url , include query parameter alt=media

get https://www.googleapis.com/drive/v2/files/0b9jnhsvvjoivm3dkcgrkrmviovu?alt=media authorization: bearer ya29.ahesvbxtuv5mhmo3ryfms1yjonjzzdtofzwvyoauvhrs  private static inputstream downloadfile(drive service, file file) { if (file.getdownloadurl() != null && file.getdownloadurl().length() > 0) { try { httpresponse resp = service.getrequestfactory().buildgetrequest(new genericurl(file.getdownloadurl())) .execute(); return resp.getcontent(); } catch (ioexception e) { // error occurred. e.printstacktrace(); return null; } } else { // file doesn't have content stored on drive. return null; } } 

there google doc formats , supported export mime, check document: https://developers.google.com/drive/v2/web/manage-downloads#downloading_google_documents


Comments

Popular posts from this blog

gridview - Yii2 DataPorivider $totalSum for a column -

java - Suppress Jboss version details from HTTP error response -

Sass watch command compiles .scss files before full sftp upload -