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

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

问题描述

如何做到这一点?我应该使用Google文档ACL来配置这样的ACL吗?



  private权限insertPermission(Drive service,String fileId)throws Exception {
Permission newPermission = new Permission();
newPermission.setType(任何人);
newPermission.setRole(reader);
newPermission.setValue();
newPermission.setWithLink(true);
返回service.permissions()。insert(fileId,newPermission).execute();
}


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

解决方案

you have to set following parameters :

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天全站免登陆