Deprecated. This class is deprecated and should not be used in new scripts.
A Comment attached to any Sites page.
Deprecated methods
Method | Return type | Brief description |
---|---|---|
| void | Deletes this comment. |
| String | Gets the email address of the author of this comment. |
| String | Gets the name of the author of this comment. |
| String | Return the content of this comment as a String. |
| Date | Return the date this comment was originally published. |
| Date | Return the date this comment was last updated. |
|
| Get the parent page of this comment. |
|
| Set the content of this comment. |
|
| Set the parent page of this comment. |
Deprecated methods
deleteComment()
deleteComment()
Deprecated. This function is deprecated and should not be used in new scripts.
Deletes this comment.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); // Let's delete all of Eric's comments for(var i = 0; i < comments.length; i++) { if(comments[i].getAuthorEmail() == "eric@example.com") { comments[i].deleteComment(); } }
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAuthorEmail()
getAuthorEmail()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets the email address of the author of this comment.
Return
String
— the author's email
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getAuthorName()
getAuthorName()
Deprecated. This function is deprecated and should not be used in new scripts.
Gets the name of the author of this comment.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var comment = comments[0]; var authorEmail = comment.getAuthorEmail();
Return
String
— the author's name
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getContent()
getContent()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the content of this comment as a String.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var content = comments[0].getContent()
Return
String
— the comment content
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 comment was originally published.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var date = comments[0].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
getLastUpdated()
getLastUpdated()
Deprecated. This function is deprecated and should not be used in new scripts.
Return the date this comment was last updated.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var date = comments[0].getLastUpdated();
Return
Date
— the last updated date
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.
Get the parent page of this comment.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var comment = comments[0]; // parentPage should be the same page as pages[0] var parentPage = comment.getParent();
Return
— the parent pagePage
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setContent(content)
setContent(content)
Deprecated. This function is deprecated and should not be used in new scripts.
Set the content of this comment.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var comment = comments[0]; comment.setContent("New Content"); // Note that this returns a Comment, so you can chain the method calls var updatedContent = comment.setContent("New Content") .getContent();
Parameters
Name | Type | Description |
---|---|---|
content | String | the new content |
Return
— this Comment for chainingComment
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 page of this comment.
var pages = SitesApp.getSite('example.com', 'mysite').getChildren(); var comments = pages[0].getComments(); var comment = comments[0]; // Let's say we want to move the comment to its parent's next neighbor .. // This will only work if the example site has multiple children var newParentPage = comment.setParent(pages[1]).getParent();
Parameters
Name | Type | Description |
---|---|---|
parent |
| the new parent |
Return
— this Comment for chainingComment
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds