0
使用谷歌的腳本,我每月的共享目錄中複製現有文檔(方法File.makeCopy()
)創建文檔。問題是每次有人在新創建的文檔中留下評論時都會收到電子郵件通知,即使源文檔的通知已被禁用。如何關閉複製文檔的通知?谷歌腳本:如何關閉評論通知文件?
執行復制的函數的代碼如下:
function createNewLogFile() {
var rootDir = DriveApp.getFolderById('0B-gPh8Bs5aLhY2g2QXRFX2hycUU');
var curDate = new Date();
var curYear = curDate.getFullYear();
var nextMonth = curDate.getMonth() + 2;
nextMonth = (nextMonth < 10) ? '0' + nextMonth : (nextMonth > 12) ? '1' : nextMonth;
var folderIter = rootDir.getFoldersByName((nextMonth > 12) ? curYear + 1 : curYear);
var curYearFolder = folderIter.hasNext() ? folderIter.next() : rootDir.createFolder(curYear);
var fileIter = curYearFolder.getFilesByName(nextMonth);
if (!fileIter.hasNext()) {
var gmLogTemplate = DriveApp.getFileById('1Vyd15DDiKqha9zlU_1Q8gRiqDY4Oqgl0VJ1uUYiBnCQ');
var monthlyLogFile = gmLogTemplate.makeCopy(curYearFolder);
monthlyLogFile.setName(nextMonth);
}
}