Google Drive API, Meta-Data -


i uploading documents google drive meta-data not appear getting me correctly.

protected file insertfile(drive service, list<string> parentids, com.google.drive.filecontent filecontent, file googlefile)throws ioexception {   // set parent folder.   if (parentids != null && parentids.size() > 0) {       list<parentreference> parentreferences = new arraylist<parentreference>();       (string parentid : parentids ){           parentreferences.add(new parentreference().setid(parentid));       }       googlefile.setparents( parentreferences );    }    try {        googlefile = service.files().insert(googlefile, filecontent).execute();        // uncomment following line print file id.       system.out.println("file id: " + googlefile.getid());        return googlefile;   }    catch (ioexception e) {       system.out.println("an error occured: " + e);       return null;   } } 

above insert statement, below sending details document.

{description=xxxxxxx invoice, fileextension=pdf, indexabletext={text=xxxxxxx invoice}, labels={restricted=false}, mimetype=application/pdf, parents=[{id=0b_owsnwrsiy7s1vswg1vntyzm1k}], properties=[{key=documenttype, value=11}], title=xxxxxxx invoice}

when same document using code

protected inputstream downloadfile(drive service, file file)throws ioexception {     if (file.getdownloadurl() != null && file.getdownloadurl().length() > 0) {          httpresponse resp =             service.getrequestfactory().buildgetrequest(new genericurl(file.getdownloadurl()))                 .execute();         return resp.getcontent();     }      else {       // file doesn't have content stored on drive.       return null;     } } 

i of text minus indexable text , file extension, correct (do not want show since contains lot of information noise)?

two separate issues here.

1) fileextension read-only field being ignored. when retrieving information, derived original title/filename. since title doesn't include ".pdf" being set empty.

2) indexabletext write-only in don't allow retrieve once set; used drive backend service search queries.

you can read more on different metadata properties of file resource in our documentation.


Comments

Popular posts from this blog

How to group boxplot outliers in gnuplot -

cakephp - simple blog with croogo -

bash - Performing variable substitution in a string -