读取 Google Drive 中公共共享文件的内容 [英] Read content of public shared file in Google Drive
问题描述
我正在开发一个 Google Drive 应用程序.
I am working on a Google Drive application.
应用程序需要读取某人的 Google Drive 中公开共享文件的内容.
The application needs to read the contents of a publically shared file in someone's Google Drive.
我该怎么做?
是否有 API 可以实现这一点?
Is there an API to achieve this?
推荐答案
使用Google Drive API时,将文件的ACL设置为public后,可以直接使用webContentLink
访问文件文件元数据的属性,在文件公开时不需要任何身份验证/授权.
When using the Google Drive API, after setting the ACL of the file to be public you can directly access the file using the webContentLink
attribute of the file metadata which should not require any authentication/authorization when the file is public.
这是一个 feil 元数据示例:https://developers.google.com/drive/v2/reference/files#resource
This is a feil metadata example: https://developers.google.com/drive/v2/reference/files#resource
这是使用常用客户端库获取文件元数据的方法:https:///developers.google.com/drive/v2/reference/files/get
This is how to get the file metadata using common client libraries: https://developers.google.com/drive/v2/reference/files/get
这篇关于读取 Google Drive 中公共共享文件的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!