首页 > 解决方案 > 我如何将函数的 fileId 用于其他函数?

问题描述

我有这两个功能,但在 DriveFile 的 id 字段中,arquivoiD 不起作用,它总是返回错误Drive materials must have an ID。”


function uploadFiles(data) {
  var arquivo = data.myFile;
  var folder = DriveApp.getFolderById("");
  var subirArquivo = folder.createFile(arquivo);
  var arquivoId = subirArquivo.getId();
  Logger.log(arquivoId)
  return subirArquivo.getUrl(); 
}

function cadastrarAV (nomeAV,curso, arquivoId){//I don't see how you are passing this id in your google.script.run....

var atividade = {
  title: nomeAV.tit ,
  description: nomeAV.desc,
   workType:  "ASSIGNMENT",
 materials: [ {
      driveFile: {//this does not look right...Cooper
      driveFile: { id : arquivoId,
                  title: "Av1"           
            },
         shareMode: "VIEW"
      }

标签: javascriptgoogle-apps-script

解决方案


推荐阅读