0

See: Is it possible to share a file publicly through Google Drive API

Using the information above, If I attempt to set the necessary permission for a specific file, I receive the following:

Error calling POST https://www.googleapis.com/drive/v2/files/{somefileid} permissions: (403) Insufficient permissions for this file

This error only occurs for google accounts tied to a google apps for edu setup where the admin has unchecked the option Google Apps -> Settings for Drive -> Share Settings -> Outside this organization: "Allow users to publish files on the web or make them visible to the world as public or unlisted files"

Using the Permission feed works fine otherwise, but ideally I would like to know if there is a way to check for this setting beforehand, instead of catching the 403 exception from the drive service.

Community
  • 1
  • 1
cody cod
  • 11
  • 2

1 Answers1

0

You can use the About.get() endpoint to get details about the user's Drive, including this sharing setting. The field domainSharingPolicy can have the values allowed, allowedWithWarning, incomingOnly and disallowed. The first two in that list should allow publishing outside the domain, while the second two should not.

Eric Koleda
  • 12,420
  • 1
  • 33
  • 51