如何从Google云端硬盘下载文件 [英] How to download a file from Google Drive

查看:3470
本文介绍了如何从Google云端硬盘下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在Google Drive SDK文档中,我找到了一个应该返回System的示例方法。 IO.Stream对象。



https://developers.google。 com / drive / manage-downloads



为此,它需要每个文件的下载URL。
但是,此下载URL并非总是指定返回。有没有人有任何想法,为什么这是?我可以做些什么呢?



更新:我发现我可以使用exportURL。这些几乎总是由服务返回。



Folowup问题:如何以特定用户身份运行应用程序? =>有时应用程序向网址发送请求,然后请求超时。当我在浏览器中尝试使用同一个网址时,它的功能就像一个魅力一样......



谢谢!

解决方案

如果您尝试下载的文件是本地Google文档格式,则不会有下载链接。如果是这种情况,您必须查找exportLinks。



您将有多个导出链接,因此您必须选择最适合您的格式:docx或odt for document例如

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 System.IO.Stream object.

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

To do so it needs the download URL for each file. However, this download URL is not always specified returned. Does anyone have any Idea why this is? And what I can do about it?

Update: I have found that I can use an exportURL. These are almost always returned by the service.

Folowup question: How can I run an app as a certain user? => sometimes the app makes a request to a url and then the request times out. When I try that same URL in a browser it works like a charm...

Thanks!

解决方案

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

这篇关于如何从Google云端硬盘下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆