通过 Google Drive API 将文件共享级别设置为“知道链接的任何人" [英] Set file sharing level to 'Anyone with the link' through Google Drive API

查看:27
本文介绍了通过 Google Drive API 将文件共享级别设置为“知道链接的任何人"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何做到这一点?我应该改用 Google Docs ACL 吗?如何配置这样的 ACL?

How to do that? Should I use Google Docs ACL instead and how to configure such ACL?

推荐答案

你必须设置以下参数:

private Permission insertPermission(Drive service, String fileId) throws Exception{
   Permission newPermission = new Permission();
   newPermission.setType("anyone");
   newPermission.setRole("reader");
   newPermission.setValue("");
   newPermission.setWithLink(true);
   return service.permissions().insert(fileId, newPermission).execute();
}

这篇关于通过 Google Drive API 将文件共享级别设置为“知道链接的任何人"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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