c# - Getting URL to uploaded file on Box.com -
i have been able upload file sample.pdf using c# program utilizing box api. (client_id, client_secret, code, postman, etc)
boxapi.v2.authentication.oauth2.oauthtoken newtoken = default(boxapi.v2.authentication.oauth2.oauthtoken); clientid = "blah blah"; clientsecret = "blah blah"; tokenprovider tokenprovider = new tokenprovider(clientid, clientsecret); streamreader streamreader = default(streamreader); streamreader = system.io.file.opentext(@"c:\boxapirefreshtoken.txt"); oldrefreshtoken = streamreader.readtoend(); streamreader.close(); newtoken = tokenprovider.refreshaccesstoken(oldrefreshtoken); boxmanager boxmanager = new boxmanager(newtoken.accesstoken); streamwriter streamwriter = new streamwriter(@"c:\boxapirefreshtoken.txt"); streamwriter.write(newtoken.refreshtoken); streamwriter.close(); folder rootfolder = default(folder); rootfolder = boxmanager.getfolder(folder.root); boxapi.v2.model.file file = boxmanager.createfile(rootfolder, attachedfilename, convertstreamtobytearray(stream));
once uploaded, wondering how can retrieve public url access file in c# program? assumed sharedlink way not sure how.
thanks
make put call on same file-id got upload. set shared-link section of json shared-link permissions want. assuming have privileges create shared-link, come in response put request.
Comments
Post a Comment