通过 Apps 脚本删除经典 Google 站点页面
Deleting Classic Google Sites pages via Apps Script
有没有办法通过 Apps 脚本删除经典网站的大部分内容?
/**
* Copyright 2021 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
/* CHANGE THE URL BELOW TO THE PAGE THAT YOU WANT TO DELETE. THEN SELECT "Run" > "deletePage" ABOVE. */
const URL = 'https://sites.google.com/site/demositeappsscript/mylistpage';
/* DON'T MODIFY ANYTHING BELOW HERE. */
function deletePage() {
const pageToDelete = SitesApp.getPageByUrl(URL);
deletePageHelper_(pageToDelete);
}
function deletePageHelper_(page) {
page.getChildren().forEach(childPage => deletePageHelper_(childPage));
Logger.log(`DELETING PAGE: "${page.getName()}".`);
page.deletePage();
}
有没有办法通过 Apps 脚本删除经典网站的大部分内容?
/**
* Copyright 2021 Google LLC.
* SPDX-License-Identifier: Apache-2.0
*/
/* CHANGE THE URL BELOW TO THE PAGE THAT YOU WANT TO DELETE. THEN SELECT "Run" > "deletePage" ABOVE. */
const URL = 'https://sites.google.com/site/demositeappsscript/mylistpage';
/* DON'T MODIFY ANYTHING BELOW HERE. */
function deletePage() {
const pageToDelete = SitesApp.getPageByUrl(URL);
deletePageHelper_(pageToDelete);
}
function deletePageHelper_(page) {
page.getChildren().forEach(childPage => deletePageHelper_(childPage));
Logger.log(`DELETING PAGE: "${page.getName()}".`);
page.deletePage();
}