mardi 28 janvier 2020

Google Drive API list all occurances of the folder

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire