Reputation: 175
I am trying to get the parent id of a file using the Google Drive API. My code is below:
$file_parent = $service->files->get($id);
var_dump($file_parent);
Unfortunately the parent object in the result is 'null' but I know it has a parent folder and I have permissions to view this. Has anybody experienced this before?
Upvotes: 2
Views: 1152
Reputation: 175
Ah solved this one myself. You have to pass through the folowing:
$optParams = array(
'fields' => "name, parents",
);
$file_parent = $service->files->get($parent, $optParams);
var_dump($file_parent);
Google aren't very clear about this!
Upvotes: 8