需要使用Google Apps脚本列出google域下的所有网站 [英] Need to list all the sites under a google domain using Google Apps Script
本文介绍了需要使用Google Apps脚本列出google域下的所有网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要使用Google Apps脚本列出google域下的所有网站.我已经写了一个小脚本,但是它只返回我创建的网站:
I need to list all the sites under a google domain using Google Apps Script. I have written a small script, but it only returns the sites I have created:
function list_sites() {
var doc = DocumentApp.create('SiteList1');
var domain = 'test.com';
var sites = SitesApp.getSites(domain);
doc.appendParagraph("Top");
doc.appendParagraph(sites);
doc.appendParagraph("Bottom");
doc.saveAndClose(); // Save and close the document
}
我如何获得所有站点?
推荐答案
您可以使用getAllSites方法.
You can use the getAllSites method.
SitesApp.getAllSites(domain, start, max)
我不确定为什么它似乎没有记载,并且不在API文档中,而是您可以找到对此的引用,并且我有一些生产脚本每天都在使用它.
I'm not sure why it's seemingly undocumented and not in the API doc but you can find references to it and I have production scripts that use it daily.
这篇关于需要使用Google Apps脚本列出google域下的所有网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文