已弃用。此类已弃用,不应在新脚本中使用。
网站 ListItem - 网站列表页面的列表元素。
已弃用的方法
方法 | 返回类型 | 简介 |
---|---|---|
| void | 删除此列表项。 |
| Date | 返回此列表项首次发布的日期。 |
| Date | 返回上次更新此评论的日期。 |
|
| 获取此列表项的父页面。 |
| String | 获取编号列中此 ListItem 的值。 |
| String | 获取命名列的 ListItem 值。 |
|
| 设置此列表项的父页面。 |
|
| 为编号列设置此 ListItem 的值。 |
|
| 为编号列设置此 ListItem 的值。 |
已弃用的方法
deleteListItem()
deleteListItem()
已弃用。此函数已弃用,不应在新脚本中使用。
删除此列表项。
// 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(); }
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getDatePublished()
getDatePublished()
已弃用。此函数已弃用,不应在新脚本中使用。
返回此列表项首次发布的日期。
var page = SitesApp.getSite('example.com', 'mysite').getChildByName('mylistpage'); var items = page.getListItems(); var date = items[0].getDatePublished();
返回
Date
- 原始发布日期
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getLastUpdated()
getLastUpdated()
已弃用。此函数已弃用,不应在新脚本中使用。
返回上次更新此评论的日期。
var page = SitesApp.getSite('example.com', 'mysite').getChildByName('mylistpage'); var items = page.getListItems(); var date = items[0].getLastUpdated();
返回
Date
- 上次更新日期
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getParent()
getParent()
getValueByIndex(index)
getValueByIndex(index)
已弃用。此函数已弃用,不应在新脚本中使用。
获取编号列中此 ListItem 的值。
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);
参数
名称 | 类型 | 说明 |
---|---|---|
index | Integer | 要获取其值的列 |
返回
String
- 该列的值
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getValueByName(name)
getValueByName(name)
已弃用。此函数已弃用,不应在新脚本中使用。
获取命名列的 ListItem 值。
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);
参数
名称 | 类型 | 说明 |
---|---|---|
name | String | 要获取其值的列 |
返回
String
- 该列的值
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
setParent(parent)
setParent(parent)
已弃用。此函数已弃用,不应在新脚本中使用。
设置此列表项的父页面。
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();
参数
名称 | 类型 | 说明 |
---|---|---|
parent |
| 新的家长 |
返回
- 此 ListItem ,用于链接ListItem
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
setValueByIndex(index, value)
setValueByIndex(index, value)
已弃用。此函数已弃用,不应在新脚本中使用。
为编号列设置此 ListItem 的值。对于网址列,值必须是 XHTML 锚标记,XML 实体已转义。
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>');
参数
名称 | 类型 | 说明 |
---|---|---|
index | Integer | 要设置 |
value | String | 新值 |
返回
- 此 ListItem ,用于链接ListItem
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
setValueByName(name, value)
setValueByName(name, value)
已弃用。此函数已弃用,不应在新脚本中使用。
为编号列设置此 ListItem 的值。对于网址列,值必须是 XHTML 锚标记,XML 实体已转义。
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>');
参数
名称 | 类型 | 说明 |
---|---|---|
name | String | 要设置 |
value | String | 新值 |
返回
- 此 ListItem ,用于链接ListItem
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds