Deprecated. This class is deprecated and should not be used in new scripts.
A Sites ListItem - a list element from a Sites List page.
Deprecated methods
Method | Return type | Brief description |
---|---|---|
| void | Deletes this list item. |
| Date | Return the date this list item was first published. |
| Date | Return the date this comment was last updated. |
|
| Get the parent page of this list item. |
| String | Get the value of this ListItem for a numbered column. |
| String | Get the value of this ListItem for a named column. |
|
| Set the parent page of this list item. |
|
| Set the value of this ListItem for a numbered column. |
|
| Set the value of this ListItem for a numbered column. |
Deprecated methods
deleteListItem()
deleteListItem()
Deprecated. This function is deprecated and should not be used in new scripts.
Deletes this list item.
// This code sample deletes all list items from a List page // Running this code sample against a Page that is a standard web page will // cause getListItems() to throw an exception var page = SitesApp.getSite('demositeappsscript').getChildByName('mylistpage'); var items = page.getListItems(); for(var i = 0; i < items.length; i++) { items[i].deleteListItem(); }
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 list item was first published.
var page = SitesApp.getSite('example.com', 'mysite').getChildByName('mylistpage'); var items = page.getListItems(); var date = items[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 page = SitesApp.getSite('example.com', 'mysite').getChildByName('mylistpage'); var items = page.getListItems(); var date = items[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 list item.
var page = SitesApp.getSite('example.com', 'mysite').getChildByName('mylistpage'); var items = page.getListItems(); // parentPage will equal page var parentPage = items[0].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
getValueByIndex(index)
getValueByIndex(index)
Deprecated. This function is deprecated and should not be used in new scripts.
Get the value of this ListItem for a numbered column.
var page = SitesApp.getSite("demositeappsscript").getChildByName("mylistpage"); var listItem = page.getListItems()[0]; // Remember that rows are 0 indexed. This returns the item in the first column // of the list. If an index that is greater than the number of columns is used, // the script will throw an "InvalidArgument: index" exception. var value = listItem.getValueByIndex(5);
Parameters
Name | Type | Description |
---|---|---|
index | Integer | the column to get the value of |
Return
String
— the value of that column
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
getValueByName(name)
getValueByName(name)
Deprecated. This function is deprecated and should not be used in new scripts.
Get the value of this ListItem for a named column.
var page = SitesApp.getSite("demositeappsscript").getChildByName("mylistpage"); var listItem = page.getListItems()[0]; // Suppose we have a column named "Owner" - this will let us fetch the value // for the list item var value = listItem.getValueByName("Owner"); Logger.log(value);
Parameters
Name | Type | Description |
---|---|---|
name | String | the column to get the value of |
Return
String
— the value of that column
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 list item.
var page = SitesApp.getSite('example.com', 'mysite').getChildByName('mylistpage'); var secondListPage = SitesApp.getSite('example.com', 'mysite') .getChildByName('secondlistpage'); var items = page.getListItems(); // Returns secondListPage var parentPage = items[0].setParent(secondListPage).getParent();
Parameters
Name | Type | Description |
---|---|---|
parent |
| the new parent |
Return
— this ListItem for chainingListItem
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setValueByIndex(index, value)
setValueByIndex(index, value)
Deprecated. This function is deprecated and should not be used in new scripts.
Set the value of this ListItem for a numbered column. For URL columns the value must be an XHTML anchor tag, with XML entities escaped.
var page = SitesApp.getSite("example.com", "mysite").getChildByName("mylistpage"); var listItem = page.getListItems()[0]; listItem.setValueByIndex(1, 'This is the new value'); listItem.setValueByIndex(2, '<a href="http://www.example.com?a=1&b=2">Example</a>');
Parameters
Name | Type | Description |
---|---|---|
index | Integer | the column to set the value of |
value | String | the new value |
Return
— this ListItem for chainingListItem
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds
setValueByName(name, value)
setValueByName(name, value)
Deprecated. This function is deprecated and should not be used in new scripts.
Set the value of this ListItem for a numbered column. For URL columns the value must be an XHTML anchor tag, with XML entities escaped.
var page = SitesApp.getSite("demositeappsscript").getChildByName("mylistpage"); var listItem = page.getListItems()[0]; listItem.setValueByName('Owner', 'Eric'); listItem.setValueByName('Page', '<a href="http://www.example.com?a=1&b=2">Example</a>');
Parameters
Name | Type | Description |
---|---|---|
name | String | the column to set the value of |
value | String | the new value |
Return
— this ListItem for chainingListItem
Authorization
Scripts that use this method require authorization with one or more of the following scopes:
-
https://sites.google.com/feeds