I'm currently playing around with Google Apps Script and can't get the following snippet to work.
The error message is: the requested resource was not found.
I also tested the undocumented method which I found here: Need to list all the sites under a google domain using Google Apps Script
var mySites = SitesApp.getAllSites(myDomain, 1, 10);
but I get the same error. For the complete example, see below. Thank you in advance.
function view() {
var myDomain = 'example.com';
// this works
var mySite = SitesApp.getSite(myDomain);
Logger.log('title=' + mySite.getTitle() + '\n' + 'name=' + mySite.getName());
// this works, too
var myPages = mySite.getAllDescendants();
for (i in myPages) {
Logger.log('page=' + myPages[i].getTitle());
}
//this does not work, error: the requested ressource was not found
var mySites = SitesApp.getSites(myDomain);
// this also does not work, same error
var mySites = SitesApp.getAllSites(myDomain, 1, 10);
}
EDIT 1: I tested with 3 different browsers on Windows 7: Firefox Nightly, Google Chrome and Opera.
EDIT 2: Same error on Samsung Galaxy Tab 10.1N with Android 3.2 and Firefox browser.
You'll get that error when the service can't find the domain or you don't have access to it. Please ensure that the domain matches exactly, and doesn't start with "www.", etc.
I think you should use:
Please try the below line