Class Site

Site

Deprecated. This class is deprecated and should not be used in new scripts.

An object representing a Google 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.
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.
getEditors()User[]Gets the list of editors for 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.
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.

Detailed documentation

addEditor(emailAddress)

Adds the given user to the list of editors for the Site. If the user was already on the list of viewers, this method promotes the user out of the list of viewers.

Parameters

NameTypeDescription
emailAddressStringThe email address of the user to add.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

addEditor(user)

Adds the given user to the list of editors for the Site. If the user was already on the list of viewers, this method promotes the user out of the list of viewers.

Parameters

NameTypeDescription
userUserA representation of the user to add.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

addEditors(emailAddresses)

Adds the given array of users to the list of editors for the Site. If any of the users were already on the list of viewers, this method promotes them out of the list of viewers.

Parameters

NameTypeDescription
emailAddressesString[]An array of email addresses of the users to add.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

addViewer(emailAddress)

Adds the given user to the list of viewers for the Site. If the user was already on the list of editors, this method has no effect.

Parameters

NameTypeDescription
emailAddressStringThe email address of the user to add.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

addViewer(user)

Adds the given user to the list of viewers for the Site. If the user was already on the list of editors, this method has no effect.

Parameters

NameTypeDescription
userUserA representation of the user to add.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

addViewers(emailAddresses)

Adds the given array of users to the list of viewers for the Site. If any of the users were already on the list of editors, this method has no effect for them.

Parameters

NameTypeDescription
emailAddressesString[]An array of email addresses of the users to add.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

getEditors()

Gets the list of editors for this Site.

Return

User[] — An array of users with edit permission.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

getViewers()

Gets the list of viewers and commenters for this Site.

Return

User[] — An array of users with view or comment permission.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

removeEditor(emailAddress)

Removes the given user from the list of editors for the Site. This method doesn't block users from accessing the Site if they belong to a class of users who have general access—for example, if the Site is shared with the user's entire domain, or if the Site is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of viewers.

Parameters

NameTypeDescription
emailAddressStringThe email address of the user to remove.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

removeEditor(user)

Removes the given user from the list of editors for the Site. This method doesn't block users from accessing the Site if they belong to a class of users who have general access—for example, if the Site is shared with the user's entire domain, or if the Site is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of viewers.

Parameters

NameTypeDescription
userUserA representation of the user to remove.

Return

Site — This Site, for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

removeViewer(emailAddress)

Removes the given user from the list of viewers and commenters for the Site. This method has no effect if the user is an editor, not a viewer or commenter. This method also doesn't block users from accessing the Site if they belong to a class of users who have general access—for example, if the Site is shared with the user's entire domain, or if the Site is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of editors.

Parameters

NameTypeDescription
emailAddressStringThe email address of the user to remove.

Return

Site — This Site for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

removeViewer(user)

Removes the given user from the list of viewers and commenters for the Site. This method has no effect if the user is an editor, not a viewer. This method also doesn't block users from accessing the Site if they belong to a class of users who have general access—for example, if the Site is shared with the user's entire domain, or if the Site is in a shared drive that the user can access.

For Drive files, this also removes the user from the list of editors.

Parameters

NameTypeDescription
userUserA representation of the user to remove.

Return

Site — This Site for chaining.

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

  • https://sites.google.com/feeds

Deprecated methods