已淘汰。這個類別已淘汰,不應用於新的指令碼。
建立及存取 Google 協作平台。
已淘汰的屬性
屬性 | 類型 | 說明 |
---|---|---|
AttachmentType |
| |
PageType |
|
已淘汰的方法
方法 | 傳回類型 | 簡短說明 |
---|---|---|
|
| 透過複製現有網站建立新網站。 |
|
| 建立新的協作平台網站。 |
|
| 如果指令碼是由容器代管,則傳回運作中的網頁,否則傳回 null 。 |
|
| 如果指令碼由容器代管,會傳回使用中的容器,否則傳回 null 。 |
|
| 擷取屬於這個網域的前 200 個協作平台。 |
|
| 擷取此網域中的所有協作平台。 |
|
| 按網址擷取網頁。 |
|
| 如果使用者不是代管網域的消費者,則擷取指定 Google 協作平台的網站。 |
|
| 擷取指定 Google 協作平台的網站。 |
|
| 透過網址擷取網站。 |
|
| 如果使用者是沒有代管網域的消費者,則擷取使用者的協作平台的第一頁。 |
|
| 如果使用者是沒有代管網域的消費者,則在指定邊界之間擷取使用者的網站。 |
|
| 擷取這個網域中這位使用者的協作平台的第一頁。 |
|
| 在指定範圍內擷取此使用者屬於此網域的所有協作平台。 |
已淘汰的方法
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)
已淘汰。此函式已淘汰,不應在新的指令碼中使用。
擷取這個網域中這位使用者的協作平台的第一頁。
// 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