允許作答者指明時間長度的題目項目。您可以透過 Form 存取或建立項目。在測驗中使用時,這些項目會獲得評分。
// Open a form by ID and add a new duration item. const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); const item = form.addDurationItem(); item.setTitle('How long can you hold your breath?');
方法
| 方法 | 傳回類型 | 簡短說明 | 
|---|---|---|
| create | Item | 為這個日期項目建立新的 Item。 | 
| duplicate() | Duration | 建立此項目的副本,並附加至表單結尾。 | 
| get | Quiz | 傳回回應,當作答者回覆可評分的題目時,系統會向他們顯示這項回應。 | 
| get | String | 取得項目的說明文字 (有時稱為版面配置項目的說明文字,例如 Image、Page和Section)。 | 
| get | Integer | 取得項目的專屬 ID。 | 
| get | Integer | 取得表單中所有項目中的項目索引。 | 
| get | Integer | 傳回可評分的項目分數。 | 
| get | String | 取得項目的標題 (在 Section的情況下,有時稱為標頭文字)。 | 
| get | Item | 取得項目的類型,以 Item表示。 | 
| is | Boolean | 決定受訪者是否必須回答問題。 | 
| set | Duration | 當作答者回覆沒有正確或錯誤答案的評分問題 (也就是需要手動評分的題目) 時,系統會顯示這項回饋。 | 
| set | Duration | 設定項目的說明文字 (對於 Image、Page和Section等版面配置項目,有時稱為說明文字)。 | 
| set | Duration | 設定可評分的項目可獲得的分數。 | 
| set | Duration | 設定受訪者是否必須回答問題。 | 
| set | Duration | 設定項目的標題 (在 Section的情況下,有時稱為標頭文字)。 | 
內容詳盡的說明文件
create
為這個日期項目建立新的 Item。hours、minutes 和 seconds 引數最好以整數表示,hours 的範圍為 0 到 72,minutes 和 seconds 的範圍為 0 到 59。超過這些邊界值會受到限制:例如 24, 60, 90 會解讀為 24:59:59。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| hours | Integer | 小時,以 0到72之間的整數表示 | 
| minutes | Integer | 分鐘,以整數表示,範圍為 0到59 | 
| seconds | Integer | 以整數表示的秒數,範圍為 0到59 | 
回攻員
Item:項目回應
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
duplicate()
建立此項目的副本,並附加至表單結尾。
回攻員
Duration:這個 Duration 的複本,用於鏈結
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
傳回回應,當作答者回覆可評分的題目時,系統會向他們顯示這項回應。
回攻員
Quiz - 意見回饋 (如果有的話)。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
取得項目的說明文字 (有時稱為版面配置項目的說明文字,例如 Image、Page 和 Section)。
回攻員
String:項目的說明文字或說明文字
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
取得項目的專屬 ID。
回攻員
Integer:商品 ID
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
取得表單中所有項目中的項目索引。
回攻員
Integer:項目索引
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
傳回可評分的項目分數。
回攻員
Integer:問題的分數。
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
取得項目的標題 (在 Section 的情況下,有時稱為標頭文字)。
回攻員
String:項目的標題或標頭文字
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
get
is
決定受訪者是否必須回答問題。
回攻員
Boolean:受訪者是否必須回答問題
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
set
當作答者回覆沒有正確或錯誤答案的評分問題 (也就是需要手動評分的題目) 時,系統會顯示這項回饋。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| feedback | Quiz | 新的意見回饋 | 
回攻員
Duration — 這個 Duration,用於鏈結
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
set
設定項目的說明文字 (對於 Image、Page 和 Section 等版面配置項目,有時稱為說明文字)。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| text | String | 新的說明文字 | 
回攻員
Duration — 這個 Duration,用於鏈結
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
set
設定可評分的項目可獲得的分數。新項目的預設值為 0。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| points | Integer | 問題項目的分數 | 
回攻員
Duration — 這個 Duration,用於鏈結
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
set
設定受訪者是否必須回答問題。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| enabled | Boolean | 是否要求受訪者回答問題 | 
回攻員
Duration:目前的項目 (用於鏈結)
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms
set
設定項目的標題 (在 Section 的情況下,有時稱為標頭文字)。
參數
| 名稱 | 類型 | 說明 | 
|---|---|---|
| title | String | 新的標題或標頭文字 | 
回攻員
Duration — 這個 Duration,用於鏈結
授權
使用這個方法的腳本需要具備下列一或多個範圍的授權:
- 
https://www.googleapis.com/auth/forms.currentonly
- 
https://www.googleapis.com/auth/forms