google drive javascript api gapi.client.drive.files undefined [英] google drive javascript api gapi.client.drive.files undefined

查看:99
本文介绍了google drive javascript api gapi.client.drive.files undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

列出Google Drive文件的JavaScript示例使用 gapi.client.drive.files.list()
当尝试使用此方法时,我收到错误Can not read property'files of of undefined。

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 'files' of undefined".

该问题和解决方法已在< a href =https://stackoverflow.com/questions/11315962> Google Drive API javascript

The issue and a workaround are already described under Google Drive API javascript

https://developers.google.com/drive/v2/reference/files/list#尝试它不正确?或者有没有一种方法可以像描述的那样使用API​​。

Is the documentation under https://developers.google.com/drive/v2/reference/files/list#try-it incorrect? Or is there a way to use the API as described.

推荐答案

JavaScript示例是正确的,但您必须确保您只能在加载Drive库时使用 gapi.client.drive.files (以及其他特定于Drive的资源),即:

The JavaScript example is correct, but you have to make sure that you only use gapi.client.drive.files (and the other Drive-specific resources) when the Drive library is loaded, i.e. after:

gapi.client.load('drive', 'v2', callback);

这篇关于google drive javascript api gapi.client.drive.files undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆