Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list files in a specific folder in Google Drive API v3 PHP

I am searching for a way, how can I list files in a specific folder (with folder id) in Google Drive API v3. I used this function $service->files->listFiles() but It return all files in google Drive. Do you know which function can I use?

like image 869
Bjørson Bjørson Avatar asked Feb 05 '17 18:02

Bjørson Bjørson


People also ask

How do I get a list of files in a Google Drive folder?

Goto the same Google Sheets File and refresh the page. Then you will get the "List Files/Folders" menu, click on it, and select the "List All Files and Folders" item.

How do I view files in Google Drive as a list?

To switch from grid view to list view, open Google Drive and press the List view button. Note: Smartbar features are available in the Google Drive file preview for Google files and non-Google files. You can access the file preview directly from grid mode.

How do I make a folder in Google Drive API?

To create a file in a folder, use the files. create method and specify the folder ID in the parents property of the file. The following code snippet shows how to create a file in a specific folder using a client library: Note: If you're using the older Drive API v2, use the files.


1 Answers

cool I found the answer.

  $optParams = array(         'pageSize' => 10,         'fields' => "nextPageToken, files(contentHints/thumbnail,fileExtension,iconLink,id,name,size,thumbnailLink,webContentLink,webViewLink,mimeType,parents)",         'q' => "'".$folderId."' in parents"         );   $results = $service->files->listFiles($optParams); 
like image 140
Bjørson Bjørson Avatar answered Sep 23 '22 14:09

Bjørson Bjørson