mardi 14 juillet 2015

Show google drive files using google drive api for javascript

I'm trying view all files and folders uploaded on my google drive. There is written in google drive documentation that you can create your appFolder and can upload/view files of that folder here is its code to list all files within application data folder.

function listFilesInApplicationDataFolder(callback) {
  var retrievePageOfFiles = function(request, result) {
    request.execute(function(resp) {
      result = result.concat(resp.items);
      var nextPageToken = resp.nextPageToken;
      if (nextPageToken) {
        request = gapi.client.drive.files.list({
          'pageToken': nextPageToken
        });
        retrievePageOfFiles(request, result);
      } else {
        callback(result);
      }
    });
  }
  var initialRequest = gapi.client.drive.files.list({
    'q': '\'appfolder\' in parents'
  });
  retrievePageOfFiles(initialRequest, []);
}

Question : can we list all files of all folders of our google drive? any help would be much appreciated.




Aucun commentaire:

Enregistrer un commentaire