The JavaScript example to list files of Google Drive uses gapi.client.drive.files.list()
.
When trying to use this method I get the error \"Cannot read property
If it works fine after writing gapi.client.load('drive', 'v2', callback)
, then all good. In my case it does not work so I wrote below code.
gapi.load('client', function () {
gapi.client.load('drive', 'v2', function () {
var file = gapi.client.drive.files.get({ 'fileId': fileId });
file.execute(function (resp) {
//Write you code with resp variable
});
});
});