7

怎么做?我应该改用 Google Docs ACL 吗?如何配置这样的 ACL?

4

4 回答 4

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();
}
于 2013-07-04T07:46:48.313 回答
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();
}

更多细节在这里

于 2012-07-03T07:34:45.437 回答
1

您必须使用 Documents List API 来管理共享。请在https://developers.google.com/google-apps/documents-list/#managing_sharing_permissions_of_resources_via_access_control_lists_acls查看文档

于 2012-06-22T20:23:14.650 回答
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();
    }
于 2018-11-08T17:02:44.890 回答