2

I would like to change the permissions of a Google Drive file with the PHP api client. Now my problem is that it doesn't set the expiration time. The user permission is successful.

The documentation says that I need to pass the date RFC3339 formatted but I'm doing that. What's wrong with this code?

$service = new Google_Service_Drive($client);
$permission = new Google_Service_Drive_Permission();
$permission->setRole('reader');
$permission->setType('user');
$permission->setEmailAddress('someone@gmail.com');
$permission->setExpirationTime(date(DateTime::RFC3339, time() + 86400));

$createPermissions = $service->permissions->create(
    $uploadedFileId,
    $permission
);

I hope someone can help me :)

Thanks!

Joshua Ott
  • 1,143
  • 10
  • 12

1 Answers1

0
  1. expirationDate works in Patch or Update
  2. this feature has never been available in the free Google accounts and was only added relatively recently to the paid G Suite accounts

and you can check on this link : https://support.google.com/docs/thread/48687182/cannot-ste-up-temporary-access-to-shared-file-as-there-is-no-such-a-function?hl=en

Joo Tarek
  • 1
  • 1