怎么做?我应该使用Google Docs ACL以及如何配置此类ACL吗?
答案 0 :(得分:20)
您必须设置以下参数:
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();
}
答案 1 :(得分:4)
使用此方法可让任何人都可以看到您的文件:
private static Permission insertPermission(Drive service, String fileId) throws IOException
{
Permission newPermission = new Permission();
newPermission.setType("anyone");
newPermission.setRole("reader");
return service.permissions().insert(fileId, newPermission).execute();
}
更多详情here。
答案 2 :(得分:1)
您必须使用Documents List API来管理共享。请查看https://developers.google.com/google-apps/documents-list/#managing_sharing_permissions_of_resources_via_access_control_lists_acls
上的文档答案 3 :(得分:0)
对于Google Drive API V3,请使用此方法使文件对所有人可见:
private Permission InsertAnyonePermissionToDownload(Google.Apis.Drive.v3.DriveService service, String fileId)
{
Permission newPermission = new Permission();
newPermission.Type = "anyone";
newPermission.Role = "reader";
return service.Permissions.Create(newPermission, fileId).Execute();
}