如何使用Google Drive API获取文件的所有者 [英] How to get the owner of file using Google Drive API

查看:361
本文介绍了如何使用Google Drive API获取文件的所有者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑开发这样的应用程序:


  1. 我的应用程序有一个Google服务帐户

  2. 我让我的用户与我的服务帐户共享他们的文档

  3. 当用户访问我的应用程序时,他根据他分享的文件获取一些报告。

为此,我的应用程序需要唯一标识与它共享的文档的所有者。我查看了API,但找不到如何操作。我找到了诸如 File.getOwnerNames(),但它们是包含名称的纯字符串,但不包含任何用于标识用户的唯一键。



如何实现这一点需要帮助。谢谢。



Sanjay

解决方案

使用 permissions.list 方法,并找到与所有者相对应的权限。

I am thinking of developing an application like this:

  1. My application has a google-service-account
  2. I let my users share their documents with my service account
  3. While an user visits my application, he gets some reports based on the files he has shared.

For this, my application needs to uniquely identify the owner of the documents shared with it. I looked at the API but could not find how to do so. I found methods like File.getOwnerNames(), but they are plain strings containing the names, but not any unique key to identify the user.

Need help on how to achieve this. Thanks.

Sanjay

解决方案

Use the permissions.list method and find the permission corresponding to the owner.

这篇关于如何使用Google Drive API获取文件的所有者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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