I'm testing out the Google Drive API. The test script does the HTTP GET to access the Files->List API but somehow I always get an empty list in items. I have hundreds of files in my google drive so the result is unexpected. The HTTP response is shown below.
{
"kind": "drive#fileList",
"etag": "\"VEU5fga3uYlZRf0pG-N1kS4iWP4/Kxo5eGvPKynWfroe9v5L5T43-n0\"",
"selfLink": "https://www.googleapis.com/drive/v2/files?maxResults=5",
"items": []
}
Google Drive users on both Android and iOS need to make sure to update the app, otherwise, the old version of the app may not work properly. So, Google Drive not showing all files error might be due to a bug in the app. Please go to the application center to check if Google Drive needs upgrading.
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.
Files stored in Google Drive can “go missing” when they become “orphaned”. This is when the file exists but the parent folders it was located in are deleted. For example, this can occur if you create a file in a folder owned by someone else and that folder is deleted.
To allow service account to access the files in my own Google Drive, I have to give permission to the email address of the service account. Once the permissions are setup correctly, the list gets populated with the files that the service account is allowed to access.
This usually means you've authenticated with a scope that doesn't give you permission to see those files.
For example, the scope https://www.googleapis.com/auth/drive.file
only provides access to files created or opened by the app. You won't be able to access files created in the Google Drive interface or by other apps.
If you want to access all the files, you'll have to use another scope. https://www.googleapis.com/auth/drive
, for example, gives you full, permissive scope to access all of a user's files.
You can find information about the available scopes here. Use it to pick the right scope for your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With