Created
November 2, 2015 04:09
-
-
Save amilabandara/f0a32265135d65e3cb61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add this function to your page | |
//after creation of file run the function in order to change the permission | |
function insertPermission($service, $fileId, $value, $type, $role) { | |
$newPermission = new Google_Service_Drive_Permission(); | |
$newPermission->setValue($value); | |
$newPermission->setType($type); | |
$newPermission->setRole($role); | |
try { | |
return $service->permissions->insert($fileId, $newPermission); | |
} catch (Exception $e) { | |
print "An error occurred: " . $e->getMessage(); | |
} | |
return NULL; | |
} | |
$permission_data = insertPermission($service, $fileId, 'your email address', 'anyone', 'reader'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment