I am using Google Drive API client
for Laravel
and I am trying to list the folders by query filters.
$scope = Config::get('options.gdrive_scopes');
putenv('GOOGLE_APPLICATION_CREDENTIALS=' . base_path() . DIRECTORY_SEPARATOR . 'gdrive_atdnj.json');
$user = Config::get('options.google_drive_user_name');
$client = new \Google_Client();
$client->useApplicationDefaultCredentials();
$client->setApplicationName(Config::get('app.name'));
$client->setScopes($scope);
$client->setAccessType('offline');
$client->setSubject($user);
$service = new \Google_Service_Drive($client);
$files_to_be_uploaded = Storage::files('orders/' . $orderId);
$project_folder_filters = array(
'fields' => 'files(id)',
'q' => "name contains '" . $project_folder_name . "' and mimeType='application/vnd.google-apps.folder'",
'supportsAllDrives' => true,
'includeItemsFromAllDrives' => true,
);
$project_folder_results = $service->files;
$project_folder_results = $service->files->listFiles($project_folder_filters);
dd($project_folder_filters, count($project_folder_results->getFiles()));
In return I am getting only one One returned in result set occurrence of the folder where on Google Drive, there are 2 folders created with the same name 2 folders with same name . Thought the owner is different. How can I all the folders by the given querystring usng google drive API?
In order for a service account to access team drives (Gsuite) domain wide delegation needs to be set up for that service account granting it access to the Gsuite drives.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.