How to do that? Should I use Google Docs ACL instead and how to configure such ACL?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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();
}
回答2:
Use this method to make your file visible to anyone:
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();
}
More details here.
回答3:
You have to use the Documents List API to manage sharing. Please check the docs at https://developers.google.com/google-apps/documents-list/#managing_sharing_permissions_of_resources_via_access_control_lists_acls
回答4:
For Google Drive API V3, use this method to make your file visible to anyone:
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();
}
标签:
google-drive-sdk