获得公众的URL来利用.NET API在谷歌驱动器文件 [英] Getting public URL to file in Google Drive using .NET API

查看:212
本文介绍了获得公众的URL来利用.NET API在谷歌驱动器文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取存储在谷歌驱动器给定文件的公开网址。我想这样做一般二进制文件(即:无PDF文件,TXT等,但一般的文件)

I am trying to get the public URL of a given file stored in Google Drive. I want to do it for general binary files (ie: no PDFs, TXT, etc., but a general file).

看的https://developers.google.com/google-apps/documents-list/#downloading_documents_and_files工程的下载的文件,但我不希望下载。我希望得到公众的网址张贴在别处。

Looking at https://developers.google.com/google-apps/documents-list/#downloading_documents_and_files works to download the file, but I do not want to download. I want to get the public URL to post it somewhere else.

请注意,该文件是在共享可见任何人联系级(所以如果我得到的链接的链接任何人都可以看到它)。

Note that the file is shared at "visible to anyone with link" level (so if I get the link anybody with the link can see it).

我发现一个黑客,使用建议从这里开始:<一href="http://stackoverflow.com/questions/9045392/getting-the-download-link-for-a-public-google-docs-file">Getting下载链接进行公开谷歌文档文件。

I found a hack, using the suggestion from here: Getting the download link for a public Google Docs file.

我建立一个像 https://docs.google.com/uc的网址是什么?出口=下载和ID = {插入DOCID这里}。我得到使用的docId谷歌数据.NET API。

I build the URL like https://docs.google.com/uc?export=download&id={Insert DocId here}. I get the DocId using the Google Data .NET API.

的事情是,在URL(https://docs.google.com/uc?export=download&id=)是很难codeD在我的code。我一直在寻找的类从API获得的,而不是建立它自己完整的URL。

The thing is that the URL (https://docs.google.com/uc?export=download&id=) is hardcoded in my code. I have been looking in the classes to get the complete URL from the API, instead of building it myself.

BTW:我使用的是谷歌数据API 2.1 的http:// code.google.com/p/google-gdata

BTW: I am using the Google Data API 2.1 http://code.google.com/p/google-gdata

感谢。

推荐答案

您可以使用谷歌驱动器API的最近发布的2.0版本列出 exportLinks 的文件存储驱动器:

You can use the recently released version 2 of the Google Drive API to list the exportLinks of a file stored on Drive:

https://developers.google.com/drive/v2/reference/files

的DLL文件API的新版本将很快公布有关的 HTTP://$c$c.google.com/p/google-api-dotnet-client/wiki/APIs#Drive_API

The dlls for the new version of the API will be published very soon on http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Drive_API

这篇关于获得公众的URL来利用.NET API在谷歌驱动器文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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