Upload files to Google Drive programmatically

2020-04-20 21:33发布

问题:

My requirement is to upload a single file which will be selected by the user during runtime to Google drive. I am getting email id and password from user. How to do it? If i any other requirement get from users? any feasible solution is there?

回答1:

You can use the Google Drive SDK/API, it's fairly simple stuff if you read through the documentation,

https://developers.google.com/drive/

https://developers.google.com/drive/manage-uploads

There's a .NET API available for download, although it's in beta I've used it without problem.

https://developers.google.com/drive/downloads



回答2:

DocumentsService myService = new DocumentsService("application name"); myService.setUserCredentials("email", "password"); DocumentEntry newEntrys = myService.UploadDocument("pdf path", @"upload file name");

But I have take exception Execution of request failed: https://docs.google.com/feeds/default/private/full?convert=false