Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set file sharing level to 'Anyone with the link' through Google Drive API

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

like image 773
user1474630 Avatar asked Jun 22 '12 11:06

user1474630


People also ask

Can Google Drive links be opened by anyone?

When you share a file with someone, you can choose their access level: Viewer: People can view, but can't change or share the file with others. Commenter: People can make comments and suggestions, but can't change or share the file with others.

Can people see my Google Drive if I send a link?

Invite-Based Google Drive Sharing For this reason, other people won't be able to access the document even if they have the link. Only the shared email address can. You can also send invites to Google Groups to quickly share your Google Drive file with a large number of individuals.


1 Answers

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();
}
like image 85
maales Avatar answered Nov 26 '22 02:11

maales