如何做到呢?我应该使用Google文档的ACL吗?如何配置这样的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();
}
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();
}
更多详细信息在此处。
对于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();
}