How to download a file from Google Drive

前端 未结 2 1603
一整个雨季
一整个雨季 2021-02-06 12:43

I am currently trying to make an application that downloads files from Google Drive.

In the Google Drive SDK documentation I found an example method that should return a

相关标签:
2条回答
  • 2021-02-06 13:04

    You won't have a downloadlink if the file you are trying to download is a native google docs format. If that's the case you must look for the exportLinks.

    You will have several export links, so you will have to choose which format suits you best : docx or odt for document for example

    0 讨论(0)
  • 2021-02-06 13:10

    Might be late but I just downloaded from Google Drive using the following code:

    var stream = service.HttpClient.GetStreamAsync(downloadUrl);
            var result = stream.Result;
            using (var fileStream = System.IO.File.Create(filePath))
            {
                result.CopyTo(fileStream);
            }
    
    0 讨论(0)
提交回复
热议问题