Deprecated. This class is deprecated and should not be used in new scripts.
A Page on a Google Site.
Deprecated methods
Method | Return type | Brief description |
---|---|---|
|
| Add a new column to the list. |
|
| Deprecated. |
|
| Add an attachment to the page. |
|
| Add an attachment to the page. |
|
| Add a list item to the list. |
|
| Add a web attachment to the page. |
|
| Create an announcements for this page. |
|
| Create an announcements for this page. |
|
| Create a new announcements page. |
|
| Create a new file-cabinet page. |
|
| Create a new list page. |
|
| Create a new page from a template. |
|
| Create a new web page. |
| void | Deletes this page. |
|
| Gets an array of descendant pages (direct and indirect), up to a limit of 200 pages. |
|
| Gets an array of descendant pages, with optional advanced arguments. |
|
| Get the announcements for this page. |
|
| Get the announcements for this page. |
|
| Get the attachments for this page. |
|
| Get the attachments for this page. |
| String[] | Get the emails of the authors of the page |
|
| Gets a particular child page. |
|
| Gets an array of child pages, up to a limit of 200 pages. |
|
| Gets an array of child pages, with optional advanced arguments. |
|
| Get the columns for the list. |
|
| Deprecated. |
|
| Deprecated. |
| Date | Return the date this page was first published. |
| String | Get the HTML content of the page. |
| Boolean | Returns whether the page is in draft mode. |
| Date | Return the last edit date, which includes only content edits. |
| Date | Return the last updated date, which includes non-content changes like moving. |
|
| Get the list items for the list. |
|
| Get the list items for the list. |
| String | Return the page's name. |
| String | Deprecated. |
|
| Return the type of this page as a SitesApp.PageType enum. |
|
| Return the parent of this page. |
| String | Deprecated. |
| String | Returns the plain-text page content. |
| String | Return the page's title. |
| String | Get the url of the page. |
| Boolean | Returns whether a page has been deleted. |
| Boolean | Returns whether this page is a copyable template. |
|
| Publish this page as a copyable template. |
|
| Gets an array of descendant pages that match a search query, up to a limit of 200 pages. |
|
| Gets an array of descendant pages that match a search query, with optional advanced arguments. |
|
| Set the HTML content of the page. |
|
| Sets whether the page is in draft mode. |
|
| Set this page's name. |
|
| Set the parent of this page. |
|
| Set the page's title. |
Deprecated methods
addColumn(name)
addColumn(name)
Deprecated. This function is deprecated and should not be used in new scripts.
Add a new column to the list. Only valid for list pages.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildByName("listpage"); // Only valid on List pages. Check for the type like so: // if(page.getPageType() == SitesApp.PageType.LIST_PAGE)) var columns = page.addColumn("new-column");
Parameters
Name | Type | Description |
---|---|---|
name | String | the new column's name |
Return
— the newly created columnColumn
Throws
Error
— for pages that aren't list pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
addComment(content)
addComment(content)
Deprecated. This function is deprecated and should not be used in new scripts.
Deprecated. Add a comment to the page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; page.addComment("This is a comment created automatically by a script using the account " + "of the user running the script");
Parameters
Name | Type | Description |
---|---|---|
content | String | the comment content |
Return
— the newly created commentComment
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
addHostedAttachment(blob)
addHostedAttachment(blob)
Deprecated. This function is deprecated and should not be used in new scripts.
Add an attachment to the page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; // Create a new blob and attach it. Many useful functions also return // blobs file uploads, URLFetch var blob = Utilities.newBlob("Here is some data", "text/plain", "data.txt"); // Note that the filename must be unique or this call will fail page.addHostedAttachment(blob);
Parameters
Name | Type | Description |
---|---|---|
blob | BlobSource | the data for the attachment |
Return
— the newly created attachmentAttachment
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
addHostedAttachment(blob, description)
addHostedAttachment(blob, description)
Deprecated. This function is deprecated and should not be used in new scripts.
Add an attachment to the page. This version of the function allows for a description.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; // Create a new blob and attach it. Many useful: functions also return // blobs file uploads, URLFetch var blob = Utilities.newBlob("Here is some data", "text/plain", "data.txt"); // Note that the filename must be unique or this call will fail page.addHostedAttachment(blob, "Some newly created data");
Parameters
Name | Type | Description |
---|---|---|
blob | BlobSource | the data for the attachment |
description | String | a description of the attachment |
Return
— the newly created attachmentAttachment
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
addListItem(values)
addListItem(values)
Deprecated. This function is deprecated and should not be used in new scripts.
Add a list item to the list. Only valid for list pages.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildByName("listpage"); // Only valid on List pages. Check for the type like so: // if(page.getPageType() == SitesApp.PageType.LIST_PAGE)) // Returns only one item page.addListItem([ "John", "Smith", "123 Main St"]);
Parameters
Name | Type | Description |
---|---|---|
values | String[] | the values for each column |
Return
— the newly created ListItemListItem
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
addWebAttachment(title, description, url)
addWebAttachment(title, description, url)
Deprecated. This function is deprecated and should not be used in new scripts.
Add a web attachment to the page. Only valid for file cabinet pages.
Web attachments are links - they are not actually hosted by Google Sites.
var site = SitesApp.getSite("example.com", "mysite"); // fetch the child - this must be a File Cabinet page // to programmatically check this, do a comparison: // if(page.getPageType() == SitesApp.PageType.FILE_CABINET_PAGE) var page = site.getChildByName("files"); page.addWebAttachment("Google Robots file", "This is Google's robots.txt file", "http://www.google.com/robots.txt");
Parameters
Name | Type | Description |
---|---|---|
title | String | the title of the attachment |
description | String | a description of the attachment |
url | String | the url of the file being attached |
Return
— the newly created attachmentAttachment
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createAnnouncement(title, html)
createAnnouncement(title, html)
Deprecated. This function is deprecated and should not be used in new scripts.
Create an announcements for this page. Only valid for announcement pages.
var site = SitesApp.getSite("example.com", "mysite"); // This snippet will only work with announcement pages - this is different // from a page that is an announcement (individual announcements). To check // if this method can be called: // if(page.getPageType() == SitesApp.PageType.ANNOUNCEMENTS_PAGE)) var page = site.getChildByName("news"); page.createAnnouncement("Breaking news!", "<h1>Apps Script rocks!</h1>");
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
html | String | the page content |
Return
— the newly created AnnouncementsPage
Throws
Error
— for pages that aren't announcement pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createAnnouncement(title, html, asDraft)
createAnnouncement(title, html, asDraft)
Deprecated. This function is deprecated and should not be used in new scripts.
Create an announcements for this page. Only valid for announcement pages.
var site = SitesApp.getSite("example.com", "mysite"); // This snippet will only work with announcement pages - this is different // from a page that is an announcement (individual announcements). To check // if this method can be called: // if(page.getPageType() == SitesApp.PageType.ANNOUNCEMENTS_PAGE)) var page = site.getChildByName("news"); page.createAnnouncement("Breaking news!", "<h1>Apps Script rocks!</h1>", true);
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
html | String | the page content |
asDraft | Boolean | whether to make the announcement a draft |
Return
— the newly created AnnouncementsPage
Throws
Error
— for pages that aren't announcement pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createAnnouncementsPage(title, name, html)
createAnnouncementsPage(title, name, html)
Deprecated. This function is deprecated and should not be used in new scripts.
Create a new announcements page. Note that a parent site or page cannot have more than 500 child pages.
// This method can be called from both a Site instance // as well as a Page instance var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; site.createAnnouncementsPage("New Announcement", "new-announcement", "<h1>Your announcement goes here</h1>"); page.createAnnouncementsPage("New Announcement", "new-announcement-child", "<h1>Your announcement goes here</h1>");
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
name | String | the page name |
html | String | the page content |
Return
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createFileCabinetPage(title, name, html)
createFileCabinetPage(title, name, html)
Deprecated. This function is deprecated and should not be used in new scripts.
Create a new file-cabinet page. Note that a parent site or page cannot have more than 500 child pages.
// This method can be called from either a site or a page. var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; site.createFileCabinetPage("New File Cabinet", "new-file-cabinet", "<h1>Your HTML here</h1>"); page.createFileCabinetPage("New File Cabinet", "new-file-cabinet-child", "<h1>Your HTML here</h1>");
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
name | String | the page name |
html | String | the page content |
Return
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createListPage(title, name, html, columnNames)
createListPage(title, name, html, columnNames)
Deprecated. This function is deprecated and should not be used in new scripts.
Create a new list page. Note that a parent site or page cannot have more than 500 child pages.
// This method can be called from either a site or a page. var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; site.createListPage("New List Page", "new-list-page", "<h1>Your List Page HTML here</h1>", [ "col1", "col2" ]); page.createListPage("New List Page", "new-list-page-child", "<h1>Your List Page HTML here</h1>", [ "col1", "col2" ]);
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
name | String | the page name |
html | String | the page content |
columnNames | String[] | the column names used for the list |
Return
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createPageFromTemplate(title, name, template)
createPageFromTemplate(title, name, template)
Deprecated. This function is deprecated and should not be used in new scripts.
Create a new page from a template. Note that a parent site or page cannot have more than 500 child pages.
// This method can be called from either a site or a page. var site = SitesApp.getSite("example.com", "mysite"); var template = site.getTemplates()[0]; // If an invalid template is passed, this will throw an "Invalid Argument" error. site.createPageFromTemplate("ClonedPage", "cloned-page", template);
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
name | String | the page name |
template |
| the template page |
Return
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
createWebPage(title, name, html)
createWebPage(title, name, html)
Deprecated. This function is deprecated and should not be used in new scripts.
Create a new web page. Note that a parent site or page cannot have more than 500 child pages.
// This method can be called from either a site or a page. var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; site.createAnnouncementsPage("New Announcement", "new-announcement", "<h1>Your announcement goes here</h1>"); page.createAnnouncementsPage("New Announcement", "new-announcement-child", "<h1>Your announcement goes here</h1>");
Parameters
Name | Type | Description |
---|---|---|
title | String | the page title |
name | String | the page name |
html | String | the page content |
Return
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
deletePage()
deletePage()
Deprecated. This function is deprecated and should not be used in new scripts.
Deletes this page.
var site = SitesApp.getSite("example.com", "mysite"); // Delete ALL the pages! var pages = site.getAllDescendants(); for(var i in pages) { pages[i].deletePage(); }
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAllDescendants()
getAllDescendants()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets an array of descendant pages (direct and indirect), up to a limit of 200 pages.
var site = SitesApp.getSite("example.com", "mysite"); var pages = site.getAllDescendants();
Return
— an array of direct and indirect child pagesPage[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAllDescendants(options)
getAllDescendants(options)
Deprecated. This function is deprecated and should not be used in new scripts.
Gets an array of descendant pages, with optional advanced arguments.
var site = SitesApp.getSite("example.com", "mysite"); var descendants = site.getAllDescendants({ type: SitesApp.PageType.WEB_PAGE, start: 0, max: 25, includeDrafts: false, includeDeleted: true, search: "target" }); for(var i in descendants) { Logger.log(descendants[i].getName()); }
Parameters
Name | Type | Description |
---|---|---|
options | Object | JavaScript object fields defined in the Advanced Arguments section below |
Advanced parameters
Name | Type | Description |
---|---|---|
type |
| only get pages of this type |
start | Integer | start the results here |
max | Integer | the max number of results (default 200) |
includeDrafts | Boolean | whether to include draft pages (default false) |
includeDeleted | Boolean | whether to include deleted pages (default false) |
search | String | only return pages matching this query |
Return
— an array of direct and indirect child pages of the given typePage[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAnnouncements()
getAnnouncements()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the announcements for this page. Only valid for announcement pages.
var site = SitesApp.getSite("example.com", "mysite"); // This snippet will only work with announcement pages - this is different // from a page that is an announcement (individual announcements). To check // if this method can be called: // if(page.getPageType() == SitesApp.PageType.ANNOUNCEMENTS_PAGE)) var page = site.getChildByName("news"); var announcements = page.getAnnouncements(); for(var i in announcements) { Logger.log(announcements[i].getHtmlContent()); }
Return
— an array of AnnouncementsPage[]
Throws
Error
— for pages that aren't announcement pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAnnouncements(optOptions)
getAnnouncements(optOptions)
Deprecated. This function is deprecated and should not be used in new scripts.
Get the announcements for this page. Only valid for announcement pages.
var site = SitesApp.getSite("example.com", "mysite"); // This snippet will only work with announcement pages - this is different // from a page that is an announcement (individual announcements). To check // if this method can be called: // if(page.getPageType() == SitesApp.PageType.ANNOUNCEMENTS_PAGE)) var page = site.getChildByName("news"); var announcements = page.getAnnouncements({ start: 0, max: 20, includeDrafts: false, includeDeleted: false, search: "Breaking" }); for(var i in announcements) { Logger.log(announcements[i].getHtmlContent()); }
Parameters
Name | Type | Description |
---|---|---|
optOptions | Object | A JavaScript object containing advanced parameters |
Advanced parameters
Name | Type | Description |
---|---|---|
start | Integer | the start index for the results |
max | Integer | the max number of results to return, which defaults to and may not be more than 200 |
includeDrafts | Boolean | whether to include draft pages (default false) |
includeDeleted | Boolean | whether to include deleted pages (default false) |
search | String | only return pages matching this query |
Return
— an array of AnnouncementsPage[]
Throws
Error
— for pages that aren't announcement pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAttachments()
getAttachments()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the attachments for this page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; var attachments = page.getAttachments(); for(var i in attachments) { Logger.log(attachments[i].getTitle()); }
Return
— an array of AttachmentsAttachment[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAttachments(optOptions)
getAttachments(optOptions)
Deprecated. This function is deprecated and should not be used in new scripts.
Get the attachments for this page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; // This returns only one attachment var attachments = page.getAttachments({ start: 0, max: 1}); for(var i in attachments) { Logger.log(attachments[i].getTitle()); }
Parameters
Name | Type | Description |
---|---|---|
optOptions | Object | a JavaScript object containing optional parameters |
Advanced parameters
Name | Type | Description |
---|---|---|
start | Integer | the first index to start returning attachments |
max | Integer | the max number of results to return, which defaults to and may not be more than 200 |
Return
— an array of AttachmentsAttachment[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAuthors()
getAuthors()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the emails of the authors of the page
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; var authors = page.getAuthors(); for(var i in authors) { Logger.log(authors[i]); }
Return
String[]
— an array of author email addresses
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getChildByName(name)
getChildByName(name)
Deprecated. This function is deprecated and should not be used in new scripts.
Gets a particular child page.
var site = SitesApp.getSite("example.com", "mysite"); var pages = site.getChildByName("childPage");
Parameters
Name | Type | Description |
---|---|---|
name | String | the child page name |
Return
— the child pagePage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getChildren()
getChildren()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets an array of child pages, up to a limit of 200 pages.
var site = SitesApp.getSite("example.com", "mysite"); var pages = site.getChildren();
Return
— an array of direct child pagesPage[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getChildren(options)
getChildren(options)
Deprecated. This function is deprecated and should not be used in new scripts.
Gets an array of child pages, with optional advanced arguments.
var site = SitesApp.getSite("example.com", "mysite"); var childPages = site.getChildren({ type: SitesApp.PageType.WEB_PAGE, start: 0, max: 25, includeDrafts: false, includeDeleted: true, search: "target" }); for(var i in childPages) { Logger.log(childPages[i].getName()); }
Parameters
Name | Type | Description |
---|---|---|
options | Object | JavaScript object fields defined in the Advanced Arguments section below |
Advanced parameters
Name | Type | Description |
---|---|---|
type |
| only get pages of this type |
start | Integer | start the results here |
max | Integer | the max number of results (default 200) |
includeDrafts | Boolean | whether to include draft pages (default false) |
includeDeleted | Boolean | whether to include deleted pages (default false) |
search | String | only return pages matching this query |
Return
— an array of direct child pages of the given typePage[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getColumns()
getColumns()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the columns for the list. Only valid for list pages.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildByName("listpage"); // Only valid on List pages. Check for the type like so: // if(page.getPageType() == SitesApp.PageType.LIST_PAGE)) var columns = page.getColumns(); for(var i in columns) { Logger.log(columns[i].getName()); }
Return
— an array of Column[]
instancesColumn
Throws
Error
— for pages that aren't list pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getComments()
getComments()
Deprecated. This function is deprecated and should not be used in new scripts.
Deprecated. Get the comments for this page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; var comments = page.getComments(); for(var i in comments) { Logger.log(comments[i].getContent()); }
Return
— an array of Comments.Comment[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getComments(optOptions)
getComments(optOptions)
Deprecated. This function is deprecated and should not be used in new scripts.
Deprecated. Get the comments for this page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; // Return only one comment var comments = page.getComments({ start:0, max: 1}); for(var i in comments) { Logger.log(comments[i].getContent()); }
Parameters
Name | Type | Description |
---|---|---|
optOptions | Object | a JavaScript object containing optional parameters |
Advanced parameters
Name | Type | Description |
---|---|---|
start | Integer | the first index to start returning comments |
max | Integer | the max number of results to return, which defaults to and may not be more than 200 |
Return
— an array of Comments.Comment[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getDatePublished()
getDatePublished()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the date this page was first published.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getName() + " was published " + page.getDatePublished());
Return
Date
— the date of original publication
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getHtmlContent()
getHtmlContent()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the HTML content of the page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getHtmlContent());
Return
String
— the html content
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getIsDraft()
getIsDraft()
Deprecated. This function is deprecated and should not be used in new scripts.
Returns whether the page is in draft mode. Only valid for announcements.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log("Is this Announcement Page a draft?", page.getIsDraft());
Return
Boolean
— whether the page is in draft mode
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getLastEdited()
getLastEdited()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the last edit date, which includes only content edits.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getName() + " was last updated " + page.getLastEdited());
Return
Date
— the date the page was last updated, including only content edits
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getLastUpdated()
getLastUpdated()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the last updated date, which includes non-content changes like moving.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getName() + " was last updated " + page.getLastUpdated());
Return
Date
— the date the page was last updated with non-content changes
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getListItems()
getListItems()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the list items for the list. Only valid for list pages.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildByName("listpage"); // Only valid on List pages. Check for the type like so: // if(page.getPageType() == SitesApp.PageType.LIST_PAGE)) var items = page.getListItems(); for(var i in items) { Logger.log(items[i].getValueByName("Status")); }
Return
— an array of ListItem[]
instancesListItem
Throws
Error
— for pages that aren't list pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getListItems(optOptions)
getListItems(optOptions)
Deprecated. This function is deprecated and should not be used in new scripts.
Get the list items for the list. Only valid for list pages.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildByName("listpage"); // Only valid on List pages. Check for the type like so: // if(page.getPageType() == SitesApp.PageType.LIST_PAGE)) // Returns only one item var items = page.getListItems({ start:0, max: 1 }); for(var i in items) { Logger.log(items[i].getValueByName("Status")); }
Parameters
Name | Type | Description |
---|---|---|
optOptions | Object | A JavaScript object of optional parameters |
Advanced parameters
Name | Type | Description |
---|---|---|
start | Integer | the first index to start iterating from |
max | Integer | the max number of results to return, which defaults to and may not be more than 200 |
Return
— an array of ListItem[]
instancesListItem
Throws
Error
— for pages that aren't list pages
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getName()
getName()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the page's name.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getName());
Return
String
— the name of this page
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getPageName()
getPageName()
Deprecated. This function is deprecated and should not be used in new scripts.
Deprecated. Replaced with getName for consistency.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getPageName());
Return
String
— the name of this page
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getPageType()
getPageType()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the type of this page as a SitesApp.PageType enum.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; var pageType = page.getPageType(); if(pageType == SitesApp.PageType.WEB_PAGE) { Logger.log(page.getName() + " is a Web Page"); }
Return
— a PageType enum telling whether this is a Web, List, Announcement or File Cabinet PagePageType
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getParent()
getParent()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the parent of this page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getName() + " parent: " + page.getParent().getName());
Return
— the parent page of this pagePage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getSelfLink()
getSelfLink()
Deprecated. This function is deprecated and should not be used in new scripts.
Deprecated. Returns the gData feed link of this page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getSelfLink());
Return
String
— the gData feed link
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getTextContent()
getTextContent()
Deprecated. This function is deprecated and should not be used in new scripts.
Returns the plain-text page content.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getName() + " content: " + page.getTextContent());
Return
String
— the plain-text content of the page
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getTitle()
getTitle()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the page's title.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getTitle());
Return
String
— the title of this page
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getUrl()
getUrl()
Deprecated. This function is deprecated and should not be used in new scripts.
Get the url of the page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; Logger.log(page.getUrl());
Return
String
— the url of the page
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
isDeleted()
isDeleted()
Deprecated. This function is deprecated and should not be used in new scripts.
Returns whether a page has been deleted.
Return
Boolean
— whether the page has been deleted
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
isTemplate()
isTemplate()
Deprecated. This function is deprecated and should not be used in new scripts.
Returns whether this page is a copyable template.
var site = SitesApp.getSite("example.com", "mysite"); var firstTemplate = site.getTemplates()[0]; if(firstTemplate.isTemplate()) { Logger.log("This will always return true"); }
Return
Boolean
— whether this page is a template
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
publishAsTemplate(name)
publishAsTemplate(name)
Deprecated. This function is deprecated and should not be used in new scripts.
Publish this page as a copyable template.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; // Turn this page into a publishable template page.publishedAsTemplate("template-name");
Parameters
Name | Type | Description |
---|---|---|
name | String | The name of the new template |
Return
— the newly published templatePage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
search(query)
search(query)
Deprecated. This function is deprecated and should not be used in new scripts.
Gets an array of descendant pages that match a search query, up to a limit of 200 pages.
var site = SitesApp.getSite("example.com", "mysite"); var matches = site.search("targetText"); for(var i in matches) { Logger.log(matches[i].getName()); }
Parameters
Name | Type | Description |
---|---|---|
query | String | the full text search query to match |
Return
— an array of direct and indirect child pages of the given typePage[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
search(query, options)
search(query, options)
Deprecated. This function is deprecated and should not be used in new scripts.
Gets an array of descendant pages that match a search query, with optional advanced arguments.
var site = SitesApp.getSite("example.com", "mysite"); var childPages = site.getChildren({ type: SitesApp.PageType.WEB_PAGE, start: 0, max: 25, includeDrafts: false, includeDeleted: true, search: "target" }); for(var i in childPages) { Logger.log(childPages[i].getName()); }
Parameters
Name | Type | Description |
---|---|---|
query | String | the full text search query to match |
options | Object | JavaScript object fields defined in the Advanced Arguments section below |
Advanced parameters
Name | Type | Description |
---|---|---|
type |
| only get pages of this type |
start | Integer | start the results here |
max | Integer | the max number of results (default 200) |
includeDrafts | Boolean | whether to include draft pages (default false) |
includeDeleted | Boolean | whether to include deleted pages (default false) |
Return
— an array of direct and indirect child pages of the given typePage[]
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setHtmlContent(html)
setHtmlContent(html)
Deprecated. This function is deprecated and should not be used in new scripts.
Set the HTML content of the page.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; page.setHtmlContent("<h1>New Page Content</h1>");
Parameters
Name | Type | Description |
---|---|---|
html | String | the new content |
Return
— this Page for chainingPage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setIsDraft(draft)
setIsDraft(draft)
Deprecated. This function is deprecated and should not be used in new scripts.
Sets whether the page is in draft mode. Only valid for announcements.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; // Take the page out of draft mode page.setIsDraft(false);
Parameters
Name | Type | Description |
---|---|---|
draft | Boolean | the new status |
Return
— this Page for chainingPage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setName(name)
setName(name)
Deprecated. This function is deprecated and should not be used in new scripts.
Set this page's name.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; page.setName("new-name");
Parameters
Name | Type | Description |
---|---|---|
name | String | the new name |
Return
— this Page for chainingPage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setParent(parent)
setParent(parent)
Deprecated. This function is deprecated and should not be used in new scripts.
Set the parent of this page.
var site = SitesApp.getSite("example.com", "mysite"); var child = site.getChildByName("childToBeMoved"); var parent = site.getChildByName("newParent"); child.setParent(parent);
Parameters
Name | Type | Description |
---|---|---|
parent |
| the new parent |
Return
— this Page for chainingPage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setTitle(title)
setTitle(title)
Deprecated. This function is deprecated and should not be used in new scripts.
Set the page's title.
var site = SitesApp.getSite("example.com", "mysite"); var page = site.getChildren()[0]; page.setTitle("New Title");
Parameters
Name | Type | Description |
---|---|---|
title | String | the new title |
Return
— this Page for chainingPage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds