通过 OAuth 成功进行全范围身份验证后:
https://www.googleapis.com/auth/drive`
我根据示例创建一个文件夹创建文件夹 https://developers.google.com/drive/v3/web/folder#creating_a_folder
var fileMetadata = {
'name' : name,
'mimeType' : 'application/vnd.google-apps.folder',
// 'parents': [ parent ]
};
gapi.client.drive.files.create({
resource: fileMetadata,
fields: 'id'
}, function(err, file) {
if(err) {
// Handle error
console.log(err);
} else {
console.log('Folder Id: ', file.id);
return file.id;
}
});
回调函数从未被调用,控制台中没有错误。
我怎样才能知道发生了什么事?
我最终使用了较低级别gapi.client.request
方法,工作可靠。
var body= {"name": name,
"mimeType": "application/vnd.google-apps.folder",
"parents": [parent.id]}
gapi.client.request({
'path': 'https://www.googleapis.com/drive/v3/files/',
'method': 'POST',
'body': body
}).then(function(jsonResp,rawResp) {
console.log(jsonResp)
if (jsonResp.status==200) {
callback(jsonResp.result)
}
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)