Calendar Service

日曆

這項服務可讓指令碼存取及修改使用者的 Google 日曆,包括使用者訂閱的其他日曆。

類別

名稱簡短說明
Calendar代表使用者擁有或訂閱的日曆。
CalendarApp允許指令碼讀取及更新使用者的 Google 日曆。
CalendarEvent代表單一日曆活動。
CalendarEventSeries代表一系列活動 (週期性活動)。
Color列舉代表 Google 日曆服務中提供的具名顏色。
EventColor列舉代表 Google 日曆服務中提供的已命名活動顏色。
EventGuest代表活動邀請對象。
EventRecurrence代表活動系列的重複週期設定。
GuestStatus列舉代表訪客可對事件具備的狀態。
RecurrenceRule代表活動系列的重複規則。
Visibility列舉代表事件的瀏覽權限。

Calendar

方法

方法傳回類型簡短說明
createAllDayEvent(title, date)CalendarEvent建立新的全天活動。
createAllDayEvent(title, startDate, endDate)CalendarEvent建立新的全天活動,範圍涵蓋多天。
createAllDayEvent(title, startDate, endDate, options)CalendarEvent建立新的全天活動,範圍涵蓋多天。
createAllDayEvent(title, date, options)CalendarEvent建立新的全天活動。
createAllDayEventSeries(title, startDate, recurrence)CalendarEventSeries建立新的全天活動系列。
createAllDayEventSeries(title, startDate, recurrence, options)CalendarEventSeries建立新的全天活動系列。
createEvent(title, startTime, endTime)CalendarEvent建立新活動。
createEvent(title, startTime, endTime, options)CalendarEvent建立新活動。
createEventFromDescription(description)CalendarEvent根據任意形式的說明建立活動。
createEventSeries(title, startTime, endTime, recurrence)CalendarEventSeries建立新的活動系列。
createEventSeries(title, startTime, endTime, recurrence, options)CalendarEventSeries建立新的活動系列。
deleteCalendar()void永久刪除日曆。
getColor()String取得日曆的顏色。
getDescription()String取得日曆的說明。
getEventById(iCalId)CalendarEvent取得具有指定 ID 的事件。
getEventSeriesById(iCalId)CalendarEventSeries取得具有指定 ID 的活動系列。
getEvents(startTime, endTime)CalendarEvent[]取得在指定時間範圍內發生的所有事件。
getEvents(startTime, endTime, options)CalendarEvent[]取得在指定時間範圍內發生的所有事件。
getEventsForDay(date)CalendarEvent[]取得在特定日期發生的所有事件。
getEventsForDay(date, options)CalendarEvent[]取得在指定日期發生的所有事件。
getId()String取得日曆的 ID。
getName()String取得日曆名稱。
getTimeZone()String取得日曆的時區。
isHidden()Boolean決定是否要在使用者介面中隱藏日曆。
isMyPrimaryCalendar()Boolean判斷該日曆是否為有效使用者的主要日曆。
isOwnedByMe()Boolean判斷日曆是否歸你所有。
isSelected()Boolean決定是否要在使用者介面中顯示日曆的活動。
setColor(color)Calendar設定日曆的顏色。
setDescription(description)Calendar設定日曆的說明。
setHidden(hidden)Calendar設定是否在使用者介面中顯示日曆。
setName(name)Calendar設定日曆名稱。
setSelected(selected)Calendar設定是否在使用者介面中顯示日曆的活動。
setTimeZone(timeZone)Calendar設定日曆的時區。
unsubscribeFromCalendar()void取消訂閱使用者的日曆。

CalendarApp

屬性

屬性類型說明
ColorColor列舉代表 Google 日曆服務中提供的具名顏色。
EventColorEventColor列舉代表 Google 日曆服務中提供的已命名活動顏色。
GuestStatusGuestStatus列舉代表訪客可對事件具備的狀態。
MonthMonth列舉代表一年中的月份。
VisibilityVisibility列舉代表事件的瀏覽權限。
WeekdayWeekday列舉代表星期幾。

方法

方法傳回類型簡短說明
createAllDayEvent(title, date)CalendarEvent建立新的全天活動。
createAllDayEvent(title, startDate, endDate)CalendarEvent建立新的全天活動,範圍涵蓋多天。
createAllDayEvent(title, startDate, endDate, options)CalendarEvent建立新的全天活動,範圍涵蓋多天。
createAllDayEvent(title, date, options)CalendarEvent建立新的全天活動。
createAllDayEventSeries(title, startDate, recurrence)CalendarEventSeries建立新的全天活動系列。
createAllDayEventSeries(title, startDate, recurrence, options)CalendarEventSeries建立新的全天活動系列。
createCalendar(name)Calendar建立使用者擁有的新日曆。
createCalendar(name, options)Calendar建立使用者擁有的新日曆。
createEvent(title, startTime, endTime)CalendarEvent建立新活動。
createEvent(title, startTime, endTime, options)CalendarEvent建立新活動。
createEventFromDescription(description)CalendarEvent根據任意形式的說明建立活動。
createEventSeries(title, startTime, endTime, recurrence)CalendarEventSeries建立新的活動系列。
createEventSeries(title, startTime, endTime, recurrence, options)CalendarEventSeries建立新的活動系列。
getAllCalendars()Calendar[]取得使用者擁有或訂閱的所有日曆。
getAllOwnedCalendars()Calendar[]取得使用者擁有的所有日曆。
getCalendarById(id)Calendar取得含有指定 ID 的日曆。
getCalendarsByName(name)Calendar[]取得其擁有或訂閱的所有日曆名稱。
getColor()String取得日曆的顏色。
getDefaultCalendar()Calendar取得使用者的預設日曆。
getDescription()String取得日曆的說明。
getEventById(iCalId)CalendarEvent取得具有指定 ID 的事件。
getEventSeriesById(iCalId)CalendarEventSeries取得具有指定 ID 的活動系列。
getEvents(startTime, endTime)CalendarEvent[]取得在指定時間範圍內發生的所有事件。
getEvents(startTime, endTime, options)CalendarEvent[]取得在指定時間範圍內發生的所有事件。
getEventsForDay(date)CalendarEvent[]取得在特定日期發生的所有事件。
getEventsForDay(date, options)CalendarEvent[]取得在指定日期發生的所有事件。
getId()String取得日曆的 ID。
getName()String取得日曆名稱。
getOwnedCalendarById(id)Calendar取得含有指定 ID (如果使用者擁有的日曆) 的日曆。
getOwnedCalendarsByName(name)Calendar[]取得使用者擁有的所有日曆名稱。
getTimeZone()String取得日曆的時區。
isHidden()Boolean決定是否要在使用者介面中隱藏日曆。
isMyPrimaryCalendar()Boolean判斷該日曆是否為有效使用者的主要日曆。
isOwnedByMe()Boolean判斷日曆是否歸你所有。
isSelected()Boolean決定是否要在使用者介面中顯示日曆的活動。
newRecurrence()EventRecurrence建立新的週期物件,可用於建立事件週期性規則。
setColor(color)Calendar設定日曆的顏色。
setDescription(description)Calendar設定日曆的說明。
setHidden(hidden)Calendar設定是否在使用者介面中顯示日曆。
setName(name)Calendar設定日曆名稱。
setSelected(selected)Calendar設定是否在使用者介面中顯示日曆的活動。
setTimeZone(timeZone)Calendar設定日曆的時區。
subscribeToCalendar(id)Calendar以指定的 ID 為使用者訂閱日曆 (如果允許使用者訂閱)。
subscribeToCalendar(id, options)Calendar以指定的 ID 為使用者訂閱日曆 (如果允許使用者訂閱)。

CalendarEvent

方法

方法傳回類型簡短說明
addEmailReminder(minutesBefore)CalendarEvent新增活動電子郵件提醒。
addGuest(email)CalendarEvent將邀請對象加入活動中。
addPopupReminder(minutesBefore)CalendarEvent將新的彈出式通知新增至事件。
addSmsReminder(minutesBefore)CalendarEvent新增活動簡訊提醒。
anyoneCanAddSelf()Boolean決定使用者是否能將自己新增為日曆活動的邀請對象。
deleteEvent()void刪除日曆活動。
deleteTag(key)CalendarEvent從事件中刪除鍵/值代碼。
getAllDayEndDate()Date取得這項全天日曆活動的結束日期。
getAllDayStartDate()Date取得這項全天日曆活動的開始日期。
getAllTagKeys()String[]取得已在事件上設定的所有代碼鍵。
getColor()String傳回日曆活動的顏色。
getCreators()String[]取得活動建立者。
getDateCreated()Date取得事件的建立日期。
getDescription()String取得活動說明。
getEmailReminders()Integer[]取得活動所有電子郵件提醒的分鐘數值。
getEndTime()Date取得這項日曆活動的結束日期和時間。
getEventSeries()CalendarEventSeries取得此活動所屬的一系列週期性活動。
getGuestByEmail(email)EventGuest取得邀請對象的電子郵件地址。
getGuestList()EventGuest[]取得活動邀請對象,包括活動擁有者。
getGuestList(includeOwner)EventGuest[]取得活動邀請對象,包括活動擁有者。
getId()String取得事件的專屬 iCalUID。
getLastUpdated()Date取得活動上次更新日期。
getLocation()String取得活動的位置。
getMyStatus()GuestStatus取得有效使用者的活動狀態 (例如參加或已邀請)。
getOriginalCalendarId()String取得建立這個活動時所在的日曆 ID。
getPopupReminders()Integer[]取得活動的所有彈出式提醒的分鐘數值。
getSmsReminders()Integer[]取得活動所有簡訊提醒的分鐘數值。
getStartTime()Date取得這個日曆活動的開始日期和時間。
getTag(key)String取得事件的代碼值。
getTitle()String取得活動名稱。
getVisibility()Visibility取得活動的瀏覽權限。
guestsCanInviteOthers()Boolean決定邀請對像是否能邀請其他邀請對象。
guestsCanModify()Boolean決定邀請對像是否可以修改活動。
guestsCanSeeGuests()Boolean決定邀請對像是否能看見其他邀請對象。
isAllDayEvent()Boolean判斷這是否為全天活動。
isOwnedByMe()Boolean判斷你是否為活動擁有者。
isRecurringEvent()Boolean判斷該活動是否屬於活動系列。
removeAllReminders()CalendarEvent用於移除活動的所有提醒。
removeGuest(email)CalendarEvent將邀請對象從活動中移除。
resetRemindersToDefault()CalendarEvent使用日曆的預設設定重設提醒。
setAllDayDate(date)CalendarEvent設定活動日期。
setAllDayDates(startDate, endDate)CalendarEvent設定活動日期。
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEvent設定非邀請對像是否能將自己加入活動。
setColor(color)CalendarEvent設定日曆活動的顏色。
setDescription(description)CalendarEvent設定事件的說明。
setGuestsCanInviteOthers(guestsCanInviteOthers)CalendarEvent設定邀請對像是否可以邀請其他邀請對象。
setGuestsCanModify(guestsCanModify)CalendarEvent設定邀請對像是否可以修改活動。
setGuestsCanSeeGuests(guestsCanSeeGuests)CalendarEvent設定邀請對像是否能看到其他邀請對象。
setLocation(location)CalendarEvent設定事件的地點。
setMyStatus(status)CalendarEvent設定有效使用者的活動狀態,例如參加或已邀請。
setTag(key, value)CalendarEvent設定事件的鍵/值標記來儲存自訂中繼資料。
setTime(startTime, endTime)CalendarEvent設定活動開始與結束的日期和時間。
setTitle(title)CalendarEvent設定活動名稱。
setVisibility(visibility)CalendarEvent設定活動的顯示設定。

CalendarEventSeries

方法

方法傳回類型簡短說明
addEmailReminder(minutesBefore)CalendarEventSeries新增活動電子郵件提醒。
addGuest(email)CalendarEventSeries將邀請對象加入活動中。
addPopupReminder(minutesBefore)CalendarEventSeries將新的彈出式通知新增至事件。
addSmsReminder(minutesBefore)CalendarEventSeries新增活動簡訊提醒。
anyoneCanAddSelf()Boolean決定使用者是否能將自己新增為日曆活動的邀請對象。
deleteEventSeries()void刪除活動系列。
deleteTag(key)CalendarEventSeries從事件中刪除鍵/值代碼。
getAllTagKeys()String[]取得已在事件上設定的所有代碼鍵。
getColor()String傳回日曆活動的顏色。
getCreators()String[]取得活動建立者。
getDateCreated()Date取得事件的建立日期。
getDescription()String取得活動說明。
getEmailReminders()Integer[]取得活動所有電子郵件提醒的分鐘數值。
getGuestByEmail(email)EventGuest取得邀請對象的電子郵件地址。
getGuestList()EventGuest[]取得活動邀請對象,包括活動擁有者。
getGuestList(includeOwner)EventGuest[]取得活動邀請對象,包括活動擁有者。
getId()String取得事件的專屬 iCalUID。
getLastUpdated()Date取得活動上次更新日期。
getLocation()String取得活動的位置。
getMyStatus()GuestStatus取得有效使用者的活動狀態 (例如參加或已邀請)。
getOriginalCalendarId()String取得建立這個活動時所在的日曆 ID。
getPopupReminders()Integer[]取得活動的所有彈出式提醒的分鐘數值。
getSmsReminders()Integer[]取得活動所有簡訊提醒的分鐘數值。
getTag(key)String取得事件的代碼值。
getTitle()String取得活動名稱。
getVisibility()Visibility取得活動的瀏覽權限。
guestsCanInviteOthers()Boolean決定邀請對像是否能邀請其他邀請對象。
guestsCanModify()Boolean決定邀請對像是否可以修改活動。
guestsCanSeeGuests()Boolean決定邀請對像是否能看見其他邀請對象。
isOwnedByMe()Boolean判斷你是否為活動擁有者。
removeAllReminders()CalendarEventSeries用於移除活動的所有提醒。
removeGuest(email)CalendarEventSeries將邀請對象從活動中移除。
resetRemindersToDefault()CalendarEventSeries使用日曆的預設設定重設提醒。
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEventSeries設定非邀請對像是否能將自己加入活動。
setColor(color)CalendarEventSeries設定日曆活動的顏色。
setDescription(description)CalendarEventSeries設定事件的說明。
setGuestsCanInviteOthers(guestsCanInviteOthers)CalendarEventSeries設定邀請對像是否可以邀請其他邀請對象。
setGuestsCanModify(guestsCanModify)CalendarEventSeries設定邀請對像是否可以修改活動。
setGuestsCanSeeGuests(guestsCanSeeGuests)CalendarEventSeries設定邀請對像是否能看到其他邀請對象。
setLocation(location)CalendarEventSeries設定事件的地點。
setMyStatus(status)CalendarEventSeries設定有效使用者的活動狀態,例如參加或已邀請。
setRecurrence(recurrence, startDate)CalendarEventSeries設定全天活動系列的重複規則。
setRecurrence(recurrence, startTime, endTime)CalendarEventSeries設定這個活動系列的重複規則。
setTag(key, value)CalendarEventSeries設定事件的鍵/值標記來儲存自訂中繼資料。
setTitle(title)CalendarEventSeries設定活動名稱。
setVisibility(visibility)CalendarEventSeries設定活動的顯示設定。

Color

屬性

屬性類型說明
BLUEEnum
藍色 (#2952A3)。
BROWNEnum
棕色 (#8D6F47)。
CHARCOALEnum
石墨黑 (#4E5D6C)。
CHESTNUTEnum
栗色 (#865A5A)。
GRAYEnum
灰色 (#5A6986)。
GREENEnum
綠色 (#0D7813)。
INDIGOEnum
靛藍色 (#5229A3)。
LIMEEnum
萊姆綠 (#528800)。
MUSTARDEnum
鬍子 (#88880E)。
OLIVEEnum
橄欖綠 (#6E6E41)。
ORANGEEnum
橘色 (#BE6D00)。
PINKEnum
粉紅色 (#B1365F)。
PLUMEnum
紫紅色 (#705770)。
PURPLEEnum
紫色 (#7A367A)。
REDEnum
紅色 (#A32929)。
RED_ORANGEEnum
紅到橘 (#B1440E)。
SEA_BLUEEnum
海水藍 (#29527A)。
SLATEEnum
插入畫面 (#4A716C)。
TEALEnum
藍綠色 (#28754E)。
TURQOISEEnum
綠松石 (#1B887A)。
YELLOWEnum
黃色 (#AB8B00)。

EventColor

屬性

屬性類型說明
PALE_BLUEEnum
淡藍色 ("1")。
PALE_GREENEnum
淡綠色 ("2")。
MAUVEEnum
Mauve ("3")。
PALE_REDEnum
淡紅色 ("4")。
YELLOWEnum
黃色 ("5")。
ORANGEEnum
橘色 ("6")。
CYANEnum
青色 ("7")。
GRAYEnum
灰色 ("8")。
BLUEEnum
藍色 ("9")。
GREENEnum
綠色 ("10")。
REDEnum
紅色 ("11")。

EventGuest

方法

方法傳回類型簡短說明
getAdditionalGuests()Integer取得這位邀請對象指定的其他參與者。
getEmail()String取得邀請對象的電子郵件地址。
getGuestStatus()GuestStatus取得活動邀請對象的狀態。
getName()String取得訪客名稱。

EventRecurrence

方法

方法傳回類型簡短說明
addDailyExclusion()RecurrenceRule新增每日排除發生的規則。
addDailyRule()RecurrenceRule加入讓事件每天重複執行的規則。
addDate(date)EventRecurrence加入讓事件在特定日期重複執行的規則。
addDateExclusion(date)EventRecurrence新增用於排除特定日期出現情況的規則。
addMonthlyExclusion()RecurrenceRule新增每月排除重複次數的規則。
addMonthlyRule()RecurrenceRule加入讓事件每月重複執行的規則。
addWeeklyExclusion()RecurrenceRule新增每週排除發生次數的規則。
addWeeklyRule()RecurrenceRule新增規則,讓事件每週重複執行。
addYearlyExclusion()RecurrenceRule新增每年排除發生次數的規則。
addYearlyRule()RecurrenceRule加入讓活動每年重複執行的規則。
setTimeZone(timeZone)EventRecurrence設定這個週期的時區。

GuestStatus

屬性

屬性類型說明
INVITEDEnum邀請對像已受邀,但並未指明他們是否參加。
MAYBEEnum邀請對象表示自己可能會參加。
NOEnum邀請對象表示自己不會參加。
OWNEREnum邀請對象為活動擁有者。
YESEnum邀請對象表示自己會參加。

RecurrenceRule

方法

方法傳回類型簡短說明
addDailyExclusion()RecurrenceRule新增每日排除發生的規則。
addDailyRule()RecurrenceRule加入讓事件每天重複執行的規則。
addDate(date)EventRecurrence加入讓事件在特定日期重複執行的規則。
addDateExclusion(date)EventRecurrence新增用於排除特定日期出現情況的規則。
addMonthlyExclusion()RecurrenceRule新增每月排除重複次數的規則。
addMonthlyRule()RecurrenceRule加入讓事件每月重複執行的規則。
addWeeklyExclusion()RecurrenceRule新增每週排除發生次數的規則。
addWeeklyRule()RecurrenceRule新增規則,讓事件每週重複執行。
addYearlyExclusion()RecurrenceRule新增每年排除發生次數的規則。
addYearlyRule()RecurrenceRule加入讓活動每年重複執行的規則。
interval(interval)RecurrenceRule設定規則,只在規則時間單位的這個間隔套用。
onlyInMonth(month)RecurrenceRule設定規則,僅套用到特定月份。
onlyInMonths(months)RecurrenceRule設定規則,僅套用到特定月份。
onlyOnMonthDay(day)RecurrenceRule設定規則,僅套用至每月的特定日。
onlyOnMonthDays(days)RecurrenceRule設定規則,僅套用到當月的特定日子。
onlyOnWeek(week)RecurrenceRule設定規則,僅套用到一年中的特定週別。
onlyOnWeekday(day)RecurrenceRule設定規則,僅套用至一週中的某一天。
onlyOnWeekdays(days)RecurrenceRule設定規則僅套用至一週中的特定日子。
onlyOnWeeks(weeks)RecurrenceRule設定規則,僅套用到一年中的特定週別。
onlyOnYearDay(day)RecurrenceRule設定規則,僅套用至一年中的特定日期。
onlyOnYearDays(days)RecurrenceRule設定規則,僅套用至一年中的特定日子。
setTimeZone(timeZone)EventRecurrence設定這個週期的時區。
times(times)RecurrenceRule將規則設為在指定重複次數後結束。
until(endDate)RecurrenceRule設定規則的結束日期 (含此日期)。
weekStartsOn(day)RecurrenceRule設定從一週的起始日,以便套用規則。

Visibility

屬性

屬性類型說明
CONFIDENTIALEnum這是私人活動。
DEFAULTEnum為日曆上的活動使用預設的顯示設定。
PRIVATEEnum這是私人活動,只有活動與會者看得到活動詳細資訊。
PUBLICEnum活動是公開的,且日曆的所有讀者都能看到活動詳細資訊。