Google drive: get (root) file and folders with javascript api (get only deleted files on disk)

Complete the authorization part and work fine (no errors, etc.). After that, I want to get folders and files from the root of the disk. Starting first, to get the files in the root (the procedure is similar to using folders with children instead).

I developed the following code (following a Google example that produces a similar result), this is part of my disk class:

o.cdGetCloudFiles = function(fCallback, sFolderId ) { var oDefQ = {q:'trashed=false', maxResults:1000, folderId:(typeof sFolderId == 'string')?sFolderId:'root'}, fGetFiles = function(request, result) { request.execute(function(resp) { if( resp.items instanceof Array ) { result = result.concat(resp.items); if( resp.nextPageToken ) { // Get next file and 'break' this function return fGetFiles(gapi.client.drive.files.list($j.extend(oDefQ,{'pageToken':resp.nextPageToken})), result); } } fCallback(result.length?result:false); }); }; fGetFiles(gapi.client.drive.files.list(oDefQ), []); }; 

The original code can be found here: https://developers.google.com/drive/v2/reference/files/list

There are two files and one directory in the root of the disk:

 [folder] Alice Deejay - Who Needs Guitars Anyway [file] A day without rain.mp3 [file] Discobitch - C'est beau la bourgeoisie.mp3 

The problem is that I am not getting files using the above example. When I change 'trashed=false' to 'trashed=true' , then I get four deleted files (previously I deleted them from the disk).

Can someone explain why I cannot see / receive any files? Also changed the rights to the public, but it seems to have no meaning.

+1
source share
1 answer

In the same situation as the following question: google drive api, javascript list files do not return anything

I needed to add the " drive " path to the scope during authorization, I only had drive.file , which is intended only for creating / editing files. It is strange that the API returns deleted files when you do not have permission to view files, I think this is an error in the API (serious).

Send this error to Google Drive: https://productforums.google.com/forum/#!searchin/drive/security $ 20issue $ 20permission $ 20view / drive / pupjKxTz9FU / cUarGIl_Ah0J

0
source

All Articles