java - Google drive getMimeType returning only null values -
i trying download files drive using version 3 of google drive api in java. need mimetype of files identify content type. when tried calling
file.getmimetype
i getting null value.
drive service=getdriveservice(); filelist result = service.files().list() .setpagesize(100) .setfields("nextpagetoken, files(id, name)") .execute(); list<file> files = result.getfiles(); if (files == null || files.size() == 0) { system.out.println("no files found."); } else { system.out.println("files:"); (file file : files) { system.out.printf("%s (%s)(%s)\n", file.getname(),file.getid(),file.getmimetype()); } }
i tried calling other methods getfullfileextension returning null values.
could please tell me did mistake? , how solve mimetype , other values.
i haven't played v3 yet, code
setfields("nextpagetoken, files(id, name)")
and
file.getmimetype()
since asked id , name fetched, shouldn't surprising mimetype null. try adding mimetype
fields in setfields
.
Comments
Post a Comment