問題項目,可讓受訪者指出日期和時間。您可以透過 Form 存取或建立項目。在測驗中使用這些項目時,系統會評分。
// Open a form by ID and add a new date-time item. const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); const item = form.addDateTimeItem(); item.setTitle('When do you want to meet?');
方法
| 方法 | 傳回類型 | 簡短說明 |
|---|---|---|
create | Item | 為這個日期時間項目建立新的 Item。 |
duplicate() | Date | 建立這個項目的副本,並附加到表單結尾。 |
get | Quiz | 傳回受訪者回答可評分問題時看到的意見回饋。 |
get | String | 取得項目的說明文字 (有時稱為版面配置項目的說明文字,例如 Image、Page 和 Section)。 |
get | Integer | 取得項目的專屬 ID。 |
get | Integer | 取得表單中所有項目中的項目索引。 |
get | Integer | 傳回可評分項目的點數值。 |
get | String | 取得項目的標題 (如果是 Section,有時稱為標頭文字)。 |
get | Item | 取得項目的類型,以 Item 表示。 |
includes | Boolean | 判斷日期項目是否包含年份選項。 |
is | Boolean | 決定受訪者是否必須回答問題。 |
set | Date | 設定作答者回答沒有正確或錯誤答案的評分問題時,系統顯示的意見回饋 (即需要手動評分的問題)。 |
set | Date | 設定項目的說明文字 (有時稱為版面配置項目的說明文字,例如 Image、Page 和 Section)。 |
set | Date | 設定日期項目是否包含年份設定。 |
set | Date | 設定可評分項目的分數。 |
set | Date | 設定受訪者是否必須回答問題。 |
set | Date | 設定項目的標題 (如果是 Section,有時也稱為標題文字)。 |
內容詳盡的說明文件
create Response(response)
為這個日期時間項目建立新的 Item。系統會忽略 Date 物件的秒數欄位;根據預設,系統會使用年、月、日、時和分欄位。如果 set 設定為 false,系統也會忽略年份。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
response | Date | 代表月、日、時、分和可能年份的 Date 物件 |
回攻員
Item - 項目回應
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
duplicate()
建立這個項目的副本,並附加到表單結尾。
回攻員
Date:這個 Date 的副本,用於串連
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get General Feedback()
傳回受訪者回答可評分問題時看到的意見回饋。
回攻員
Quiz:意見回饋 (如有)。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Help Text()
取得項目的說明文字 (有時稱為版面配置項目的說明文字,例如 Image、Page 和 Section)。
回攻員
String:項目的說明文字
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Id()
取得項目的專屬 ID。
回攻員
Integer:商品的 ID
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Index()
取得表單中所有項目中的項目索引。
回攻員
Integer:項目的索引
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Points()
傳回可評分項目的點數值。
回攻員
Integer:問題的分數。
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Title()
取得項目的標題 (如果是 Section,有時稱為標頭文字)。
回攻員
String:項目的標題或標頭文字
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
get Type()
includes Year()
判斷日期項目是否包含年份選項。
回攻員
Boolean - true (如果日期包含年份設定);false (如果日期不包含年份設定)
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
is Required()
決定受訪者是否必須回答問題。
回攻員
Boolean - 受訪者是否必須回答問題
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set General Feedback(feedback)
設定作答者回答沒有正確或錯誤答案的評分問題時,系統顯示的意見回饋 (即需要手動評分的問題)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
feedback | Quiz | 新的意見回饋 |
回攻員
Date - this Date,用於鏈結
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Help Text(text)
設定項目的說明文字 (有時稱為版面配置項目的說明文字,例如 Image、Page 和 Section)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
text | String | 新的說明文字 |
回攻員
Date - this Date,用於鏈結
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Includes Year(enableYear)
設定日期項目是否包含年份設定。新日期項目的預設值為 true。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
enable | Boolean | 如果日期包含年份設定,則為 true;否則為 false |
回攻員
Date - this Date,用於鏈結
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Points(points)
設定可評分項目的分數。新項目的預設值為 0。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
points | Integer | 問題項目的分數 |
回攻員
Date - this Date,用於鏈結
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Required(enabled)
設定受訪者是否必須回答問題。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
enabled | Boolean | 受訪者是否必須回答問題 |
回攻員
Date - 目前項目 (用於鏈結)
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms
set Title(title)
設定項目的標題 (如果是 Section,有時也稱為標題文字)。
參數
| 名稱 | 類型 | 說明 |
|---|---|---|
title | String | 新標題或標頭文字 |
回攻員
Date - this Date,用於鏈結
授權
使用這個方法的指令碼需要一或多個下列範圍的授權:
-
https://www.googleapis.com/auth/forms.currentonly -
https://www.googleapis.com/auth/forms