谷歌驱动器 javascript api gapi.client.drive.files 未定义 [英] google drive javascript api gapi.client.drive.files undefined
问题描述
列出 Google Drive 文件的 JavaScript 示例使用 gapi.client.drive.files.list()
.尝试使用此方法时出现错误无法读取未定义的属性'文件'".
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".
https://developers.google 下的文档.com/drive/v2/reference/files/list#try-it 不正确?或者有没有办法按照描述使用 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 示例是正确的,但您必须确保您只使用 gapi.client.drive.files
(以及其他驱动器特定资源)加载驱动器库时,即之后:
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);
这篇关于谷歌驱动器 javascript api gapi.client.drive.files 未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!