create a shortcut to a file in google drive api php client v2

I believe your goal and situation as follows.

  • You want to create new shortcut using googleapis for php.
  • You have already been able to use Drive API.

In this case, I would like to propose to use setShortcutDetails() in your script. When your script is modified, it becomes as follows.

Modified script:

$file = new \Google_Service_Drive_DriveFile();
$file->setName('Shortcut Name');

$shortcutDetails = new \Google_Service_Drive_DriveFileShortcutDetails();

$createdFile = $service->files->create($file);
  • Please set $parent_id and $file_id.


CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top