Google Apps Script

Sites Service

This service provides access to Google Sites.

Classes

NameBrief description
AttachmentA Sites Attachment such as a file attached to a page.
AttachmentTypeA typesafe enum for sites attachment type.
ColumnA Sites Column - a column from a Sites List page.
CommentA Comment attached to any Sites page.
ListItemA Sites ListItem - a list element from a Sites List page.
PageA Page on a Google Site.
PageTypeA typesafe enum for sites page type.
SiteAn object representing a Google Site.
SitesAppCreate and access Google Sites.

Class Attachment

Methods

MethodReturn typeBrief description
deleteAttachment()voidDeletes this attachment.
getAs(contentType)BlobReturn the data inside this object as a blob converted to the specified content type.
getAttachmentType()AttachmentTypeReturn the type of this attachment (HOSTED or WEB).
getBlob()BlobReturn the data inside this object as a blob.
getContentType()StringReturn the mime type of this attachment.
getDatePublished()DateReturn the date this attachment was first published.
getDescription()StringReturn the description of this attachment.
getLastUpdated()DateReturn the date this attachment was last updated.
getParent()PageGet the parent page of this attachment.
getTitle()StringReturn the title of this attachment.
getUrl()StringReturn the download url for this attachment.
setContentType(contentType)AttachmentSet the mime type of this attachment.
setDescription(description)AttachmentSet the descripton of this attachment.
setFrom(blob)AttachmentSet the actual data of this attachment.
setParent(parent)AttachmentSet the parent page of this attachment.
setTitle(title)AttachmentSet the title of this attachment.
setUrl(url)AttachmentSets the download url for this attachment.

Class AttachmentType

Properties

PropertyTypeDescription
WEBEnum
HOSTEDEnum

Class Column

Methods

MethodReturn typeBrief description
deleteColumn()voidDeletes this column.
getName()StringGets the name of this column.
getParent()PageReturns the List Page this column belongs to.
setName(name)ColumnSets the name of this column.

Class Comment

Methods

MethodReturn typeBrief description
deleteComment()voidDeletes this comment.
getAuthorEmail()StringGets the email address of the author of this comment.
getAuthorName()StringGets the name of the author of this comment.
getContent()StringReturn the content of this comment as a String.
getDatePublished()DateReturn the date this comment was originally published.
getLastUpdated()DateReturn the date this comment was last updated.
getParent()PageGet the parent page of this comment.
setContent(content)CommentSet the content of this comment.
setParent(parent)CommentSet the parent page of this comment.

Class ListItem

Methods

MethodReturn typeBrief description
deleteListItem()voidDeletes this list item.
getDatePublished()DateReturn the date this list item was first published.
getLastUpdated()DateReturn the date this comment was last updated.
getParent()PageGet the parent page of this list item.
getValueByIndex(index)StringGet the value of this ListItem for a numbered column.
getValueByName(name)StringGet the value of this ListItem for a named column.
setParent(parent)ListItemSet the parent page of this list item.
setValueByIndex(index, value)ListItemSet the value of this ListItem for a numbered column.
setValueByName(name, value)ListItemSet the value of this ListItem for a numbered column.

Class Page

Methods

MethodReturn typeBrief description
addColumn(name)ColumnAdd a new column to the list.
addComment(content)CommentAdd a comment to the page.
addHostedAttachment(blob)AttachmentAdd an attachment to the page.
addHostedAttachment(blob, description)AttachmentAdd an attachment to the page.
addListItem(values)ListItemAdd a list item to the list.
addWebAttachment(title, description, url)AttachmentAdd a web attachment to the page.
createAnnouncement(title, html)PageCreate an announcements for this page.
createAnnouncement(title, html, asDraft)PageCreate an announcements for this page.
createAnnouncementsPage(title, name, html)PageCreate a new AnnouncementsPage.
createFileCabinetPage(title, name, html)PageCreate a new FileCabinetPage.
createListPage(title, name, html, columnNames)PageCreate a new ListPage.
createPageFromTemplate(title, name, template)PageCreate a new page from a template.
createWebPage(title, name, html)PageCreate a new WebPage.
deletePage()voidDeletes this page.
getAllDescendants()Page[]Get the first page of descendant pages.
getAllDescendants(options)Page[]Get all descendant pages of the given type.
getAnnouncements()Page[]Get the announcements for this page.
getAnnouncements(optOptions)Page[]Get the announcements for this page.
getAttachments()Attachment[]Get the attachments for this page.
getAttachments(optOptions)Attachment[]Get the attachments for this page.
getAuthors()String[]Get the emails of the authors of the page
getChildByName(name)PageGets a particular child page.
getChildren()Page[]Get the first page of child pages.
getChildren(options)Page[]Get all child pages with optional advanced arguments
getColumns()Column[]Get the columns for the list.
getComments()Comment[]Get the comments for this page.
getComments(optOptions)Comment[]Get the comments for this page.
getDatePublished()DateReturn the date this page was first published.
getHtmlContent()StringGet the HTML content of the page.
getIsDraft()BooleanReturns whether the page is in draft mode.
getLastEdited()DateReturn the last edit date, which includes only content edits.
getLastUpdated()DateReturn the last updated date, which includes non-content changes like moving.
getListItems()ListItem[]Get the list items for the list.
getListItems(optOptions)ListItem[]Get the list items for the list.
getName()StringReturn the page's name.
getPageType()PageTypeReturn the type of this page as a SitesApp.PageType enum.
getParent()PageReturn the parent of this page.
getTextContent()StringReturns the plain-text page content.
getTitle()StringReturn the page's title.
getUrl()StringGet the url of the page.
isDeleted()BooleanReturns whether a page has been deleted.
isTemplate()BooleanReturns whether this page is a copyable template.
publishAsTemplate(name)PagePublish this page as a copyable template.
search(query)Page[]Get all descendant pages matching a search.
search(query, options)Page[]Get all descendant pages matching a search.
setHtmlContent(html)PageSet the HTML content of the page.
setIsDraft(draft)PageSets whether the page is in draft mode.
setName(name)PageSet this page's name.
setParent(parent)PageSet the parent of this page.
setTitle(title)PageSet the page's title.

Class PageType

Properties

PropertyTypeDescription
WEB_PAGEEnum
LIST_PAGEEnum
ANNOUNCEMENTEnum
ANNOUNCEMENTS_PAGEEnum
FILE_CABINET_PAGEEnum

Class Site

Methods

MethodReturn typeBrief description
addEditor(emailAddress)SiteAdds the given user to the list of editors for the Site.
addEditor(user)SiteAdds the given user to the list of editors for the Site.
addEditors(emailAddresses)SiteAdds the given array of users to the list of editors for the Site.
addOwner(email)SiteAdd a new owner to the website
addOwner(user)SiteAdd a new owner to the website
addViewer(emailAddress)SiteAdds the given user to the list of viewers for the Site.
addViewer(user)SiteAdds the given user to the list of viewers for the Site.
addViewers(emailAddresses)SiteAdds the given array of users to the list of viewers for the Site.
createAnnouncementsPage(title, name, html)PageCreate a new AnnouncementsPage.
createFileCabinetPage(title, name, html)PageCreate a new FileCabinetPage.
createListPage(title, name, html, columnNames)PageCreate a new ListPage.
createPageFromTemplate(title, name, template)PageCreate a new page from a template.
createWebPage(title, name, html)PageCreate a new WebPage.
getAllDescendants()Page[]Get the first page of descendant pages.
getAllDescendants(options)Page[]Get all descendant pages of the given type.
getChildByName(name)PageGets a particular child page.
getChildren()Page[]Get the first page of child pages.
getChildren(options)Page[]Get all child pages with optional advanced arguments
getEditors()User[]Gets the list of editors for this Site.
getName()StringReturn the name of the site
getOwners()User[]Retrieves list of owners for the site
getSummary()StringReturn the summary of the web site
getTemplates()Page[]Returns all template pages.
getTheme()StringGets the theme of the site
getTitle()StringReturn the title of the site
getUrl()StringRetrieves the url of this Site.
getViewers()User[]Gets the list of viewers and commenters for this Site.
removeEditor(emailAddress)SiteRemoves the given user from the list of editors for the Site.
removeEditor(user)SiteRemoves the given user from the list of editors for the Site.
removeOwner(email)SiteRemoves owner from the site by user email
removeOwner(user)SiteRemoves owner from the site
removeViewer(emailAddress)SiteRemoves the given user from the list of viewers and commenters for the Site.
removeViewer(user)SiteRemoves the given user from the list of viewers and commenters for the Site.
search(query)Page[]Get all descendant pages matching a search.
search(query, options)Page[]Get all descendant pages matching a search.
setSummary(summary)SiteSet the summary of the web site
setTheme(theme)SiteSets the theme of the site Theme must be a valid theme string.
setTitle(title)SiteSet the title of the site

Class SitesApp

Properties

PropertyTypeDescription
AttachmentTypeAttachmentType
PageTypePageType

Methods

MethodReturn typeBrief description
copySite(domain, name, title, summary, site)SiteCreates a new Site by copying an existing Site.
createSite(domain, name, title, summary)SiteCreates a new Site.
getActivePage()PageReturns the active page, if the script is hosted in a container, or null otherwise.
getActiveSite()SiteReturns the active container, if the script is hosted in a container, or null otherwise.
getAllSites(domain)Site[]Retrieves first page of Sites belonging to this domain.
getAllSites(domain, start, max)Site[]Retrieves all Sites belonging to this domain.
getPageByUrl(url)PageRetrieves a Page by url.
getSite(name)SiteRetrieves a Site for the given Google Site, if the user is a consumer who does not have a hosted domain.
getSite(domain, name)SiteRetrieves a Site for the given Google Site.
getSiteByUrl(url)SiteRetrieves a Site by url.
getSites()Site[]Retrieves first page of Sites for a user, if the user is a consumer who does not have a hosted domain.
getSites(start, max)Site[]Retrieves Sites for a user between the given bounds if the user is a consumer who does not have a hosted domain.
getSites(domain)Site[]Retrieves first page of Sites belonging to this user in this domain.
getSites(domain, start, max)Site[]Retrieves all Sites belonging to this user in this domain for the given range given.

Authentication required

You need to be signed in with Google+ to do that.

Signing you in...

Google Developers needs your permission to do that.