I’m upgrading from v2 to v3 of the Google Drive API on Android and would like to know how to get some extra fields when I query for files, ideally without paging.
This is the code I got:
FileList result = drive.files().list() .setQ("'root' in parents and trashed=false") .setFields("files(id, name, fileSize, modifiedDate, mimeType)") .execute();
But it says that
invalid field selection fileSize.
Also I would like a way to get a download url for the file that works temporarily for sharing with other apps. This used to be achievable with
getDownloadUrl and adding the token on v2.
Edit: Looks like the correct fields are:
.setFields("files(id, name, size, modifiedTime)")
files(size) works although I don’t see it documented. You can try it here.
I am not so sure about
getDownloadUrl. You can check the v2 to v3 conversion documentation at this page. It suggests that
files.get with ?alt=media might be a suitable replacement for
Answered By – Cheticamp
Answer Checked By – Cary Denson (Easybugfix Admin)