Download file from Google Drive using C # without Google API

As requested, the client provides exe- (which contains the URL of the download file). If we use google api, we need to provide additional links along with exe. Client is not allowed.

I used webclient to upload a file, but uploaded a file with a document type like HTML. My requirement is to upload a google drive form file without using the Google API . Is there any way to do this?

I tried the code as below

 WebClient wb = new WebClient();          
 wb.DownloadFile("https://drive.google.com/file/d/0BzpAdEg-KyDjNVVSb0FBOWQ4V0k/view?usp=sharing", @"C:\TFS\test\test.pdf");

Result as below

enter image description here

+4
source share
1 answer

This will help you.

URL- google-.

https://drive.google.com/file/d/FILE_ID/edit?usp=sharing

, :

https://drive.google.com/uc?export=download&id=FILE_ID

, .

, , URL- https://drive.google.com/file/d/ABCDEFG1234567/edit?usp=sharing

URL- https://drive.google.com/uc?export=download&id=ABCDEFG1234567

: , , (, , , ), google. ( , )

Edit:

, , url , , .

+5

Source: https://habr.com/ru/post/1626313/


All Articles