已弃用。此类已弃用,不应在新脚本中使用。
创建和访问 Google 协作平台。
已弃用的属性
媒体资源 | 类型 | 说明 |
---|---|---|
AttachmentType |
| |
PageType |
|
已废弃的方法
方法 | 返回类型 | 简介 |
---|---|---|
|
| 通过复制现有网站来创建新网站。 |
|
| 创建新的网站。 |
|
| 如果脚本托管在容器中,则返回活动网页,否则返回 null 。 |
|
| 如果脚本托管在容器中,则返回活跃容器;否则,返回 null 。 |
|
| 检索属于此网域的前 200 个网站。 |
|
| 检索属于此网域的所有网站。 |
|
| 按网址检索页面。 |
|
| 如果用户是没有托管网域的使用方,则检索给定 Google 协作平台的网站。 |
|
| 检索指定 Google 协作平台的 Site。 |
|
| 按网址检索网站。 |
|
| 检索用户网站的第一页,前提是该用户是没有托管网域的使用方。 |
|
| 在用户是没有托管网域的使用方时,检索指定范围之间的用户网站。 |
|
| 检索此网域中该用户拥有的协作平台的第一页。 |
|
| 在指定的范围内,检索此网域中属于该用户的所有网站。 |
已废弃的方法
copySite(domain, name, title, summary, site)
copySite(domain, name, title, summary, site)
已弃用。此函数已弃用,不应在新脚本中使用。
通过复制现有网站来创建新网站。
警告:复制网站需要几秒到数分钟的时间,具体取决于网站的大小。虽然该方法会立即返回,但复制操作仍在后台进行,并非所复制网站中的所有网页都立即可用。此方法还可用于根据给定模板实例化新网站。
// This creates a site. Note that this only works for Google Workspace domains. // There is no version of this API for consumer accounts. var site = SitesApp.createSite("examplepetstore.com", "homepage", "My Home Page", "This is a new site I created!"); var siteCopy = SitesApp.copySite("examplepetstore.com", "homepage-clone", "Cloned Home Page", "Begun, these clone wars have.", site);
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
name | String | 网址中出现的网络空间名称,例如 mySite。 |
title | String | 网站的标题 |
summary | String | 网站的说明 |
site |
| 要从中复制内容的网站。这可以是网站或模板。如果该参数是现有网站,则该网站的所有内容都将被复制。如果给定网站是模板,则系统会基于该模板创建新网站。 |
弃踢回攻
- 已复制的网站。请注意,复制是异步进行的,即使返回了对网站的引用,复制操作可能仍在进行中。Site
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
createSite(domain, name, title, summary)
createSite(domain, name, title, summary)
已弃用。此函数已弃用,不应在新脚本中使用。
创建新的网站。
// This creates a site. Note that this only works for Google Workspace domains. // There is no version of this API for consumer accounts. var site = SitesApp.createSite("examplepetstore.com", "homepage", "My Home Page", "This is a new site I created!");
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
name | String | 网址中的路径名称,例如 mySite。 |
title | String | 网站的标题。 |
summary | String | 网站的说明。 |
弃踢回攻
- 创建的网站。Site
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getActivePage()
getActivePage()
getActiveSite()
getActiveSite()
getAllSites(domain)
getAllSites(domain)
已弃用。此函数已弃用,不应在新脚本中使用。
检索属于此网域的前 200 个网站。如需获取所有网站,请使用
方法对结果进行分页。
getAllSites(domain, start, max)
// This writes the first page of sites belonging to a Google Workspace // domain to the log. var sites = SitesApp.getAllSites("examplepetstore.com."); for(var i in sites) { Logger.log(sites[i].getUrl()); }
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
弃踢回攻
- 属于该网域的一组网站。Site[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getAllSites(domain, start, max)
getAllSites(domain, start, max)
已弃用。此函数已弃用,不应在新脚本中使用。
检索属于此网域的所有网站。
// This writes the a list of sites in domain example.com to the log. var pageStart = 0; var pageSize = 50; while (true) { Logger.log("Loading sites starting at %s", pageStart); var sites = SitesApp.getAllSites("examplepetstore.com", pageStart, pageSize); if (sites.length == 0) { break; } Logger.log("Got %s sites back", sites.length); pageStart += sites.length; for(var i in sites) { Logger.log("Found site: %s", sites[i].getUrl()); } }
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
start | Integer | 要返回的第一个网站的索引。 |
max | Integer | 要返回的结果数上限。 |
弃踢回攻
- 属于该网域的一组网站。Site[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getPageByUrl(url)
getPageByUrl(url)
已弃用。此函数已弃用,不应在新脚本中使用。
按网址检索页面。
// This snippet retrieves the page at the given URL. // Returns null if the page does not exist or if the URL given is invalid. var page = SitesApp.getPageByUrl( "https://sites.google.com/site/demositeappsscript/mylistpage"); Logger.log(page.getName());
参数
名称 | 类型 | 说明 |
---|---|---|
url | String | 公开网址。 |
弃踢回攻
- 与网址中的网页对应的 Page
实例,如果该网页不存在,则为 Pagenull
。
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getSite(name)
getSite(name)
getSite(domain, name)
getSite(domain, name)
已弃用。此函数已弃用,不应在新脚本中使用。
检索指定 Google 协作平台的网站。
// Returns a Site instance var site = SitesApp.getSite('example.com', 'mysite');
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
name | String | 网址中出现的网络空间名称,例如 mySite。 |
弃踢回攻
- 与托管网域对应的网站实例。Site
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getSiteByUrl(url)
getSiteByUrl(url)
已弃用。此函数已弃用,不应在新脚本中使用。
按网址检索网站。
// This snippet retrieves the site at the given URL // Throws an Invalid argument exception if the site does not exist or if // the URL given is invalid var site = SitesApp.getSiteByUrl("https://sites.google.com/site/demosite"); Logger.log(site.getName());
参数
名称 | 类型 | 说明 |
---|---|---|
url | String | 公开网址。 |
弃踢回攻
- 在指定网址上找到的网站。Site
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getSites()
getSites()
已弃用。此函数已弃用,不应在新脚本中使用。
如果用户是没有托管网域的使用方,则检索其网站的第一页。
// This writes the first page of sites owned by the user running // the script to the log. var sites = SitesApp.getSites(); for(var i in sites) { Logger.log(sites[i].getUrl()); }
弃踢回攻
- 一组网站,专属于运行脚本的用户。Site[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getSites(start, max)
getSites(start, max)
getSites(domain)
getSites(domain)
已弃用。此函数已弃用,不应在新脚本中使用。
检索此网域中该用户的 Google 协作平台第一页。
// This writes the first page of sites owned by the user running // the script to the log. var sites = SitesApp.getSites("example.com"); for(var i in sites) { Logger.log(sites[i].getUrl()); }
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
弃踢回攻
- 一组网站,专属于运行脚本的用户。Site[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds
getSites(domain, start, max)
getSites(domain, start, max)
已弃用。此函数已弃用,不应在新脚本中使用。
在指定的范围内,检索此网域中属于该用户的所有网站。
// This writes the a list of sites owned by the user running // the script in positions bounded by the start and max values to the log. var sites = SitesApp.getSites("example.com", 25, 50); for(var i in sites) { Logger.log(sites[i].getUrl()); }
参数
名称 | 类型 | 说明 |
---|---|---|
domain | String | Google Workspace 托管的网域,例如 examplepetstore.com。 |
start | Integer | 要返回的第一个网站的索引。 |
max | Integer | 要返回的结果数上限。 |
弃踢回攻
- 属于用户的一组网站。Site[]
授权
使用此方法的脚本需要获得以下一个或多个范围的授权:
-
https://sites.google.com/feeds