我正在尝试从复制的Google云端硬盘文件中检索ID。每当我尝试检索driveResponse.id时,它总是以未定义的形式返回。这是重要的代码:
let request = {
name: title,
};
var template = '1234567890987654321';
var presentationId;
return new Promise((resolve, reject) => {
drive.files.copy({
fileId: template,
resource: request,
}, (err, driveResponse) => {
if (err){
console.log("There was an error: " + err);
}else{
console.log('Created presentation with title: ' + title);
//error happens here
let presentationCopyId = driveResponse.id;
console.log(presentationCopyId);
resolve(presentationCopyId);
r2.question("Presentation Id: ", function(presentationIdIn){
presentationId = presentationIdIn;
console.log("Please wait");
r2.close();
任何帮助将不胜感激。谢谢!