1

DriveApp がリリースされる約 1 週間前から、このエラーに悩まされていました。エラーで断続的に失敗するコードのセクションがあります。

サービスが短時間に何度も呼び出されました: driveWriteVolume rateMax。呼び出しの間に Utilities.sleep(1000) を試してください。

問題のコードは次のとおりです。

for(var a = 0; a<attachments.length; a++){

   if(a > 0){
     child = "." + (a + 1) + " ";
   }
   else{
     child = ".1 ";
   }

   var parent = (m + 1);
   Utilities.sleep(5000);
   var file = attachmentFolder.createFile(attachments[a]);//This is the line that causes the error.
   Utilities.sleep(1000);
   file.rename(parent + child + attachments[a].getName());

}

私は 1000 ミリ秒から始めて、徐々に 5000 ミリ秒まで上げましたが、それでも 200 ミリ秒ごとにエラーがスローされます。これはDocsListを使用しています。

4

1 に答える 1

0

私が取り組んでいるスクリプトで同様の問題が発生しました。

メッセージへの添付ファイルをループして保存しようとすると、問題が発生します。添付ファイルをスキップしても、ファイル作成の総数が同じで、それらの間のスリープ時間が同じであっても、問題はありません。これは私が使用しているコードです。 newFolder.createFile(pdfBlob)問題はありません。 newFolder.createFile(attachmentBlob)します。

        // Create the message PDF inside the new folder
        var htmlBodyFile = newFolder.createFile('body.html', messageBody, "text/html");
        var pdfBlob = htmlBodyFile.getAs('application/pdf');
        pdfBlob.setName(newFolderName + ".pdf");
        newFolder.createFile(pdfBlob);
        Utilities.sleep(sleepTime);  // wait after creating something on the drive.
        htmlBodyFile.setTrashed(true);


        // Save attachments
        Logger.log("Saving Attachments");
        for(var i = 0; i < messageAttachments.length; i++) {
          Logger.log("Saving Attachment " + i);
          var attachmentBlob = messageAttachments[i].copyBlob();
          newFolder.createFile(attachmentBlob);
          Utilities.sleep(sleepTime);  // wait after creating something on the drive.
        } // each attachment
于 2013-05-23T22:58:43.823 に答える