我创建了一个脚本,其中列出了 Google Drive 位置的内容,但是我收到了失败通知。请注意,我并不总是收到失败通知,并且我无法可靠地重新创建问题。
// Expose contents of Drive to File Cabinet URL
function showFolderInSite() {
var folders = DocsList.getFolderById("FOLDERID").getFolders();
var files = DocsList.getFolderById("FOLDERID").getFiles();
var page = SitesApp.getPageByUrl("LINKTOFILECABINET");
var attachments = page.getAttachments();
// Remove dups
for(i in attachments){
attachments[i].deleteAttachment();
}
// Iterate files
for(i in files){
page.addWebAttachment(files[i].getName(), '', files[i].getUrl());
}
// Iterate folders
for(i in folders){
page.addWebAttachment(folders[i].getName(), '', folders[i].getUrl());
}
}