Class CalendarApp

CalendarApp

스크립트가 사용자의 Google Calendar를 읽고 업데이트하도록 허용합니다. 이 클래스를 통해 사용자의 기본 캘린더에 직접 액세스할 수 있을 뿐만 아니라 사용자가 소유하거나 구독 중인 추가 캘린더를 검색할 수 있습니다.

속성

속성유형설명
ColorColor캘린더 서비스에서 사용할 수 있는 이름이 지정된 색상을 나타내는 열거형입니다.
EventColorEventColor캘린더 서비스에서 사용할 수 있는 이름이 지정된 이벤트 색상을 나타내는 열거형입니다.
GuestStatusGuestStatus참석자의 일정 상태를 나타내는 enum입니다.
MonthMonth연중 월을 나타내는 열거형입니다.
VisibilityVisibility이벤트의 공개 상태를 나타내는 enum입니다.
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로 사용자의 캘린더를 구독합니다.

자세한 문서

createAllDayEvent(title, date)

새 종일 일정을 만듭니다.

// Creates an all-day event for the moon landing and logs the ID.
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Apollo 11 Landing',
    new Date('July 20, 1969'));
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
titleString이벤트 제목입니다.
dateDate이벤트 날짜입니다 (날짜만 사용되며 시간은 무시됨).

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEvent(title, startDate, endDate)

여러 날에 걸친 새 종일 일정을 만듭니다.

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'));
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
titleString이벤트 제목입니다.
startDateDate이벤트가 시작되는 날짜입니다 (날짜만 사용되며 시간은 무시됨).
endDateDate이벤트가 종료되는 날짜입니다 (날짜만 사용되며 시간은 무시됨). 종료일은 제외됩니다.

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEvent(title, startDate, endDate, options)

여러 날에 걸친 새 종일 일정을 만듭니다.

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and logs the ID.
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'),
    {location: 'Bethel, White Lake, New York, U.S.', sendInvites: true});
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
titleString이벤트 제목입니다.
startDateDate이벤트가 시작되는 날짜입니다 (날짜만 사용되며 시간은 무시됨).
endDateDate이벤트가 종료되는 날짜입니다 (날짜만 사용되며 시간은 무시됨). 종료일은 제외됩니다.
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체입니다.

고급 매개변수

이름유형설명
descriptionString이벤트 설명입니다.
locationString이벤트의 위치입니다.
guestsString게스트로 추가해야 하는 쉼표로 구분된 이메일 주소 목록입니다.
sendInvitesBoolean초대 이메일 전송 여부 (기본값: false)

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEvent(title, date, options)

새 종일 일정을 만듭니다.

// Creates an all-day event for the moon landing and logs the ID.
var event = CalendarApp.getDefaultCalendar().createAllDayEvent('Apollo 11 Landing',
    new Date('July 20, 1969'),
    {location: 'The Moon'});
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
titleString이벤트 제목입니다.
dateDate이벤트 날짜입니다 (날짜만 사용되며 시간은 무시됨).
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체입니다.

고급 매개변수

이름유형설명
descriptionString이벤트 설명입니다.
locationString이벤트의 위치입니다.
guestsString게스트로 추가해야 하는 쉼표로 구분된 이메일 주소 목록입니다.
sendInvitesBoolean초대 이메일 전송 여부 (기본값: false)

리턴

CalendarEvent - 생성된 이벤트입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEventSeries(title, startDate, recurrence)

새 종일 일정 시리즈를 만듭니다.

// Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    CalendarApp.newRecurrence().addWeeklyRule()
        .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
        .until(new Date('January 1, 2014')));
Logger.log('Event Series ID: ' + eventSeries.getId());

매개변수

이름유형설명
titleString시리즈의 이벤트 제목
startDateDate일련의 첫 번째 이벤트의 날짜 (날짜만 사용되며 시간은 무시됨)
recurrenceEventRecurrence일정 시리즈의 반복 설정

리턴

CalendarEventSeries: 생성된 이벤트 시리즈

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createAllDayEventSeries(title, startDate, recurrence, options)

새 종일 일정 시리즈를 만듭니다.

// Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    CalendarApp.newRecurrence().addWeeklyRule()
        .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
        .until(new Date('January 1, 2014')),
    {guests: 'everyone@example.com'});
Logger.log('Event Series ID: ' + eventSeries.getId());

매개변수

이름유형설명
titleString시리즈의 이벤트 제목
startDateDate일련의 첫 번째 이벤트의 날짜 (날짜만 사용되며 시간은 무시됨)
recurrenceEventRecurrence일정 시리즈의 반복 설정
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 매개변수

이름유형설명
descriptionString시리즈의 이벤트 설명
locationString반복 일정의 위치
guestsString일련의 일정에 참석자로 추가해야 하는 쉼표로 구분된 이메일 주소 목록
sendInvitesBoolean초대 이메일 전송 여부 (기본값: false)

리턴

CalendarEventSeries: 생성된 이벤트 시리즈

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createCalendar(name)

사용자가 소유한 새 캘린더를 만듭니다.

// Creates a new calendar named "Travel Plans".
var calendar = CalendarApp.createCalendar('Travel Plans');
Logger.log('Created the calendar "%s", with the ID "%s".',
    calendar.getName(), calendar.getId());

매개변수

이름유형설명
nameString새 캘린더의 이름

리턴

Calendar: 새로 만든 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createCalendar(name, options)

사용자가 소유한 새 캘린더를 만듭니다.

// Creates a new calendar named "Travel Plans" with a summary and color.
var calendar = CalendarApp.createCalendar('Travel Plans', {
  summary: 'A calendar to plan my travel schedule.',
  color: CalendarApp.Color.BLUE
});
Logger.log('Created the calendar "%s", with the ID "%s".',
    calendar.getName(), calendar.getId());

매개변수

이름유형설명
nameString새 캘린더의 이름
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 매개변수

이름유형설명
locationString캘린더 위치
summaryString캘린더 설명
timeZoneString캘린더를 설정할 시간대로 'long' 형식으로 지정됩니다 (예: 'America/New_York', Joda.org에서 등록)
colorString16진수 색상 문자열 ('#rrggbb') 또는 CalendarApp.Colors의 값
hiddenBoolean캘린더가 사용자 인터페이스에서 숨겨졌는지 여부입니다 (기본값: false).
selectedBoolean캘린더 일정을 사용자 인터페이스에 표시할지 여부 (기본값: true)

리턴

Calendar: 새로 만든 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEvent(title, startTime, endTime)

새 이벤트를 만듭니다.

시간대를 지정하지 않으면 시간 값이 스크립트 시간대의 컨텍스트로 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Creates an event for the moon landing and logs the ID.
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 21, 1969 21:00:00 UTC'));
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
titleString일정 제목
startTimeDate이벤트가 시작되는 날짜 및 시간
endTimeDate이벤트가 종료되는 날짜 및 시간

리턴

CalendarEvent: 생성된 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEvent(title, startTime, endTime, options)

새 이벤트를 만듭니다.

시간대를 지정하지 않으면 시간 값이 스크립트 시간대의 컨텍스트로 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Creates an event for the moon landing and logs the ID.
var event = CalendarApp.getDefaultCalendar().createEvent('Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 20, 1969 21:00:00 UTC'),
    {location: 'The Moon'});
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
titleString일정 제목
startTimeDate이벤트가 시작되는 날짜 및 시간
endTimeDate이벤트가 종료되는 날짜 및 시간
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 매개변수

이름유형설명
descriptionString이벤트 설명
locationString이벤트 위치
guestsString참석자로 추가해야 하는 쉼표로 구분된 이메일 주소 목록
sendInvitesBoolean초대 이메일 전송 여부 (기본값: false)

리턴

CalendarEvent: 생성된 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEventFromDescription(description)

자유 형식 설명으로 이벤트를 만듭니다.

설명은 UI의 '빠른 추가' 기능과 동일한 형식을 사용해야 합니다.

// Creates a new event and logs its ID.
var event = CalendarApp.getDefaultCalendar()
    .createEventFromDescription('Lunch with Mary, Friday at 1PM');
Logger.log('Event ID: ' + event.getId());

매개변수

이름유형설명
descriptionString자유 형식의 이벤트 설명

리턴

CalendarEvent: 생성된 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEventSeries(title, startTime, endTime, recurrence)

새 일정 시리즈를 만듭니다.

// Creates an event series for a team meeting, taking place every Tuesday and Thursday in 2013.
var eventSeries = CalendarApp.getDefaultCalendar().createEventSeries('Team Meeting',
    new Date('January 1, 2013 03:00:00 PM EST'),
    new Date('January 1, 2013 04:00:00 PM EST'),
    CalendarApp.newRecurrence().addWeeklyRule()
        .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
        .until(new Date('January 1, 2014')));
Logger.log('Event Series ID: ' + eventSeries.getId());

매개변수

이름유형설명
titleString시리즈의 이벤트 제목
startTimeDate반복 일정의 첫 번째 일정이 시작되는 날짜 및 시간
endTimeDate반복 일정의 첫 번째 일정이 종료되는 날짜 및 시간
recurrenceEventRecurrence일정 시리즈의 반복 설정

리턴

CalendarEventSeries: 생성된 이벤트 시리즈

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

createEventSeries(title, startTime, endTime, recurrence, options)

새 일정 시리즈를 만듭니다.

// Creates an event series for a team meeting, taking place every Tuesday and Thursday in 2013.
var eventSeries = CalendarApp.getDefaultCalendar().createEventSeries('Team Meeting',
    new Date('January 1, 2013 03:00:00 PM EST'),
    new Date('January 1, 2013 04:00:00 PM EST'),
    CalendarApp.newRecurrence().addWeeklyRule()
        .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
        .until(new Date('January 1, 2014')),
    {location: 'Conference Room'});
Logger.log('Event Series ID: ' + eventSeries.getId());

매개변수

이름유형설명
titleString시리즈의 이벤트 제목
startTimeDate반복 일정의 첫 번째 일정이 시작되는 날짜 및 시간
endTimeDate반복 일정의 첫 번째 일정이 종료되는 날짜 및 시간
recurrenceEventRecurrence일정 시리즈의 반복 설정
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 매개변수

이름유형설명
descriptionString시리즈의 이벤트 설명
locationString반복 일정의 위치
guestsString일련의 일정에 참석자로 추가해야 하는 쉼표로 구분된 이메일 주소 목록
sendInvitesBoolean초대 이메일 전송 여부 (기본값: false)

리턴

CalendarEventSeries: 생성된 이벤트 시리즈

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

getAllCalendars()

사용자가 소유하거나 구독 중인 모든 캘린더를 가져옵니다.

// Determines how many calendars the user can access.
var calendars = CalendarApp.getAllCalendars();
Logger.log('This user owns or is subscribed to %s calendars.',
    calendars.length);

리턴

Calendar[]: 사용자가 액세스할 수 있는 모든 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getAllOwnedCalendars()

사용자가 소유한 모든 캘린더를 가져옵니다.

// Determines how many calendars the user owns.
var calendars = CalendarApp.getAllOwnedCalendars();
Logger.log('This user owns %s calendars.', calendars.length);

리턴

Calendar[]: 사용자가 소유한 모든 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getCalendarById(id)

지정된 ID로 캘린더를 가져옵니다.

// Gets the public calendar "US Holidays" by ID.
var calendar = CalendarApp.getCalendarById(
    'en.usa#holiday@group.v.calendar.google.com');
Logger.log('The calendar is named "%s".', calendar.getName());

매개변수

이름유형설명
idString캘린더 ID

리턴

Calendar: 지정된 ID가 있는 캘린더입니다. 사용자가 캘린더에 액세스할 수 없거나 캘린더를 구독하지 않은 경우에는 null입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getCalendarsByName(name)

사용자가 소유하거나 구독 중인 지정된 이름의 모든 캘린더를 가져옵니다. 이름은 대소문자를 구분하지 않습니다.

// Gets the public calendar named "US Holidays".
var calendars = CalendarApp.getCalendarsByName('US Holidays');
Logger.log('Found %s matching calendars.', calendars.length);

매개변수

이름유형설명
nameString캘린더 이름

리턴

Calendar[]: 사용자가 액세스할 수 있는 이 이름의 모든 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getColor()

캘린더의 색상을 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the color of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getColor() instead.
const calendarColor = calendar.getColor();
console.log(calendarColor);

리턴

String - 16진수 색상 문자열 ('#rrggbb')입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getDefaultCalendar()

사용자의 기본 캘린더를 가져옵니다.

// Determines the time zone of the user's default calendar.
var calendar = CalendarApp.getDefaultCalendar();
Logger.log('My default calendar is set to the time zone "%s".',
    calendar.getTimeZone());

리턴

Calendar: 사용자의 기본 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getDescription()

캘린더의 설명을 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Sets the description of the calendar to 'Test description.'
calendar.setDescription('Test description');

// Gets the description of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getDescription() instead.
const description = calendar.getDescription();
console.log(description);

리턴

String - 이 캘린더의 설명입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventById(iCalId)

지정된 ID의 이벤트를 가져옵니다. 시리즈가 기본 캘린더가 아닌 다른 캘린더에 속한 경우 해당 캘린더에서 이 메서드를 호출해야 합니다. getEventById(iCalId)을 호출하면 기본 캘린더의 일정만 반환됩니다.

여러 이벤트가 일정 시리즈의 일부인 경우 동일한 ID를 가질 수 있습니다. 이 경우 이 메서드는 해당 시리즈의 첫 번째 이벤트만 반환합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com')

// Creates an event for the moon landing.
const event = calendar.createEvent('Apollo 11 Landing',
  new Date('July 20, 1969 20:05:00 UTC'),
  new Date('July 20, 1969 20:17:00 UTC'));

// Gets the calendar event ID and logs it to the console.
const iCalId = event.getId();
console.log(iCalId);

// Gets the event by its ID and logs the title of the event to the console.
// For the default calendar, you can use CalendarApp.getEventById(iCalId) instead.
const myEvent = calendar.getEventById(iCalId);
console.log(myEvent.getTitle());

매개변수

이름유형설명
iCalIdString이벤트의 ID입니다.

리턴

CalendarEvent - 지정된 ID의 이벤트 또는 이벤트가 없거나 사용자가 이벤트에 액세스할 수 없는 경우 null입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventSeriesById(iCalId)

지정된 ID의 이벤트 계열을 가져옵니다. 제공된 ID가 단일 CalendarEvent의 경우 CalendarEventSeries가 시리즈의 단일 이벤트와 함께 반환됩니다. 일정 시리즈가 기본 캘린더가 아닌 다른 캘린더에 속한 경우 이 메서드는 해당 CalendarApp에서 호출되어야 합니다. getEventSeriesById(iCalId)를 직접 호출하면 기본 캘린더에 있는 일정 시리즈만 반환됩니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Creates an event series for a daily team meeting from 1 PM to 2 PM.
// The series adds the daily event from January 1, 2023 through December 31, 2023.
const eventSeries = calendar.createEventSeries('Team meeting',
  new Date('Jan 1, 2023 13:00:00'),
  new Date('Jan 1, 2023 14:00:00'),
  CalendarApp.newRecurrence().addDailyRule().until(new Date('Jan 1, 2024')));

// Gets the ID of the event series.
const iCalId = eventSeries.getId();

// Gets the event series by its ID and logs the series title to the console.
// For the default calendar, you can use CalendarApp.getEventSeriesById(iCalId) instead.
console.log(calendar.getEventSeriesById(iCalId).getTitle());

매개변수

이름유형설명
iCalIdString이벤트 시리즈의 ID입니다.

리턴

CalendarEventSeries - 지정된 ID가 있는 시리즈입니다. 시리즈가 존재하지 않거나 사용자가 액세스할 수 없는 경우 null입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEvents(startTime, endTime)

지정된 시간 범위 내에서 발생하는 모든 이벤트를 가져옵니다.

이 메서드는 지정된 기간에 시작했거나, 시간 범위 내에 종료되거나, 기간을 포함하는 이벤트를 반환합니다. 시간대를 지정하지 않으면 시간 값이 스크립트 시간대의 컨텍스트로 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Determines how many events are happening in the next two hours.
var now = new Date();
var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
var events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow);
Logger.log('Number of events: ' + events.length);

매개변수

이름유형설명
startTimeDate기간의 시작
endTimeDate기간의 끝(해당 값 포함)

리턴

CalendarEvent[]: 기간 내에서 발생하는 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEvents(startTime, endTime, options)

지정된 시간 범위 내에서 발생하고 지정된 기준을 충족하는 모든 이벤트를 가져옵니다.

이 메서드는 지정된 기간에 시작했거나, 특정 기간에 종료되거나, 기간을 포함하는 이벤트를 반환합니다. 시간대를 지정하지 않으면 시간 값이 스크립트 시간대의 컨텍스트로 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

startmax를 적용한 후에 author, search 또는 statusFilters 필터링이 발생한다는 점에 유의하세요. 즉, 추가 이벤트가 기준을 충족하더라도 반환되는 이벤트 수가 max보다 적을 수 있습니다.

// Determines how many events are happening in the next two hours that contain the term
// "meeting".
var now = new Date();
var twoHoursFromNow = new Date(now.getTime() + (2 * 60 * 60 * 1000));
var events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow,
    {search: 'meeting'});
Logger.log('Number of events: ' + events.length);

매개변수

이름유형설명
startTimeDate기간의 시작
endTimeDate기간의 끝(해당 값 포함)
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 매개변수

이름유형설명
startInteger반환할 첫 번째 이벤트의 색인
maxInteger반환할 최대 이벤트 수
authorString이벤트 생성자가 결과를 필터링하는 데 사용하는 이메일 주소
searchString결과를 필터링하는 데 사용되는 전체 텍스트 검색어
statusFilters[]GuestStatus결과를 필터링하는 데 사용되는 상태 배열

리턴

CalendarEvent[]: 기간 내에서 발생하고 기준과 일치하는 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventsForDay(date)

지정된 날짜에 발생하는 모든 이벤트를 가져옵니다.

이 메서드는 지정된 날짜에 시작되거나, 하루 중에 종료되거나, 하루를 포함하는 경우 이벤트를 반환합니다.

날짜 객체의 날짜 부분만 사용되며 시간 부분은 무시됩니다. 날짜는 캘린더 시간대에서 해당 날짜부터 다음 날 자정까지로 해석됩니다.

// Determines how many events are happening today.
var today = new Date();
var events = CalendarApp.getDefaultCalendar().getEventsForDay(today);
Logger.log('Number of events: ' + events.length);

매개변수

이름유형설명
dateDate이벤트를 가져올 날짜 (날짜만 사용되며 시간은 무시됨)

리턴

CalendarEvent[]: 지정된 날짜에 발생하는 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getEventsForDay(date, options)

지정된 날짜에 발생하고 지정된 기준을 충족하는 모든 이벤트를 가져옵니다.

이 메서드는 지정된 날짜에 시작되거나, 하루 중에 종료되거나, 하루를 포함하는 경우 이벤트를 반환합니다.

날짜 객체의 날짜 부분만 사용되며 시간 부분은 무시됩니다. 날짜는 캘린더 시간대에서 해당 날짜부터 다음 날 자정까지로 해석됩니다.

startmax를 적용한 후에 author, search 또는 statusFilters 필터링이 발생한다는 점에 유의하세요. 즉, 추가 이벤트가 기준을 충족하더라도 반환되는 이벤트 수가 max보다 적을 수 있습니다.

// Determines how many events are happening today and contain the term "meeting".
var today = new Date();
var events = CalendarApp.getDefaultCalendar().getEventsForDay(today, {search: 'meeting'});
Logger.log('Number of events: ' + events.length);

매개변수

이름유형설명
dateDate이벤트를 가져올 날짜 (날짜만 사용되며 시간은 무시됨)
optionsObject고급 필터링 옵션

고급 매개변수

이름유형설명
startInteger반환할 첫 번째 이벤트의 색인
maxInteger반환할 최대 이벤트 수
authorString이벤트 생성자가 결과를 필터링하는 데 사용하는 이메일 주소
searchString결과를 필터링하는 데 사용되는 전체 텍스트 검색어
statusFilters[]GuestStatus결과를 필터링하는 데 사용되는 상태 배열

리턴

CalendarEvent[]: 지정된 날짜에 발생하여 기준과 일치하는 이벤트

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getId()

캘린더의 ID를 가져옵니다. 사용자의 기본 캘린더 ID는 이메일 주소입니다.

// Opens the calendar by its ID.
// To get the user's default calendar, use CalendarApp.getDefaultCalendar().
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the ID of the calendar and logs it to the console.
const calendarId = calendar.getId();
console.log(calendarId);

리턴

String - 캘린더의 ID입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getName()

캘린더의 이름을 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the name of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getName() instead.
const calendarName = calendar.getName();
console.log(calendarName);

리턴

String — 이 캘린더의 이름입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getOwnedCalendarById(id)

사용자가 캘린더를 소유한 경우 지정된 ID가 있는 캘린더를 가져옵니다.

캘린더 ID를 찾으려면 Google Calendar에서 캘린더 이름 옆에 있는 화살표를 클릭하고 캘린더 설정을 선택합니다. ID는 설정 페이지 하단에 표시됩니다.

// Gets a (non-existent) private calendar by ID.
var calendar = CalendarApp.getOwnedCalendarById(
    '123456789@group.calendar.google.com');
Logger.log('The calendar is named "%s".', calendar.getName());

매개변수

이름유형설명
idString캘린더 ID

리턴

Calendar - 지정된 ID가 있는 캘린더 또는 캘린더가 없거나 사용자가 소유하지 않은 경우 null입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getOwnedCalendarsByName(name)

사용자가 소유한 지정된 이름의 모든 캘린더를 가져옵니다. 이름은 대소문자를 구분하지 않습니다.

// Gets a private calendar named "Travel Plans".
var calendars = CalendarApp.getOwnedCalendarsByName('Travel Plans');
Logger.log('Found %s matching calendars.', calendars.length);

매개변수

이름유형설명
nameString캘린더 이름

리턴

Calendar[]: 사용자가 소유한 이 이름을 가진 모든 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

getTimeZone()

캘린더의 시간대를 가져옵니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the time zone of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getTimeZone() instead.
const timeZone = calendar.getTimeZone();
console.log(timeZone);

리턴

String - 'long' 형식으로 지정된 시간대입니다 (예: Joda.org에서 나열한 'America/New_York').

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isHidden()

캘린더가 사용자 인터페이스에 숨겨져 있는지 여부를 결정합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Determines whether the calendar is hidden in the user interface and logs it to the console.
// For the default calendar, you can use CalendarApp.isHidden() instead.
const isHidden = calendar.isHidden();
console.log(isHidden);

리턴

Boolean - 캘린더가 사용자 인터페이스에서 숨겨져 있으면 true이고 그렇지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isMyPrimaryCalendar()

캘린더가 유효 사용자의 기본 캘린더인지 여부를 결정합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Determines whether the calendar is the default calendar for
// the effective user and logs it to the console.
// For the default calendar, you can use CalendarApp.isMyPrimaryCalendar() instead.
const isMyPrimaryCalendar = calendar.isMyPrimaryCalendar();
console.log(isMyPrimaryCalendar);

리턴

Boolean: 캘린더가 유효 사용자의 기본 캘린더이면 true이고 그렇지 않으면 false입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isOwnedByMe()

캘린더를 내가 소유하고 있는지 확인합니다.

// Gets a calendar by its ID. To get the user's default calendar, use
// CalendarApp.getDefault() instead.
// TODO(developer): Replace the ID with the calendar ID that you want to use.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Determines whether the calendar is owned by you and logs it.
console.log(calendar.isOwnedByMe());

리턴

Boolean: 캘린더를 소유한 경우 true, 소유하지 않은 경우 false입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

isSelected()

캘린더의 일정을 사용자 인터페이스에 표시할지 결정합니다.

// Gets the user's default calendar. To get a different calendar, use getCalendarById()
// instead.
const calendar = CalendarApp.getDefaultCalendar();

// Determines whether the calendar's events are displayed in the user interface and logs it.
console.log(calendar.isSelected());

리턴

Boolean - 캘린더의 일정이 사용자 인터페이스에 표시되는 경우 true, 표시되지 않으면 false

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

newRecurrence()

이벤트 반복 규칙을 만드는 데 사용할 수 있는 새 반복 객체를 만듭니다.

// Creates an event series for a no-meetings day, taking place every Wednesday in 2013.
var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
    .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
    .until(new Date('January 1, 2014'));
var eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries('No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    recurrence);
Logger.log('Event Series ID: ' + eventSeries.getId());

리턴

EventRecurrence: 설정된 규칙이 없는 새 반복 객체 (주간 반복으로 동작)

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.googleapis.com/auth/calendar.readonly
  • https://www.google.com/calendar/feeds

setColor(color)

캘린더의 색상을 설정합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Sets the color of the calendar to pink using the Calendar Color enum.
// For the default calendar, you can use CalendarApp.setColor() instead.
calendar.setColor(CalendarApp.Color.PINK);

매개변수

이름유형설명
colorStringCalendarApp.Color 또는 16진수 색상 문자열('#rrggbb')입니다.

리턴

Calendar - 연결을 위한 캘린더입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setDescription(description)

캘린더의 설명을 설정합니다.

// Gets the user's default calendar. To get a different calendar, use getCalendarById()
// instead.
const calendar = CalendarApp.getDefaultCalendar();

// Sets the description of the calendar.
// TODO(developer): Update the string with the description that you want to use.
calendar.setDescription('Updated calendar description.')

매개변수

이름유형설명
descriptionString캘린더 설명

리턴

Calendar: 연결용 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setHidden(hidden)

캘린더를 사용자 인터페이스에 표시할지 여부를 설정합니다.

매개변수

이름유형설명
hiddenBoolean사용자 인터페이스에서 캘린더를 숨기려면 true, 캘린더를 표시하려면 false

리턴

Calendar: 연결용 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setName(name)

캘린더의 이름을 설정합니다.

// Gets the user's default calendar. To get a different calendar, use getCalendarById()
// instead.
const calendar = CalendarApp.getDefaultCalendar();

// Sets the name of the calendar.
// TODO(developer): Update the string with the name that you want to use.
calendar.setName('Example calendar name');

매개변수

이름유형설명
nameString새 이름

리턴

Calendar: 연결용 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setSelected(selected)

캘린더의 일정을 사용자 인터페이스에 표시할지 여부를 설정합니다.

// Gets the user's default calendar. To get a different calendar, use getCalendarById()
// instead.
const calendar = CalendarApp.getDefaultCalendar();

// Selects the calendar so that its events are displayed in the user interface. To
// unselect the calendar, set the parameter to false.
calendar.setSelected(true);

매개변수

이름유형설명
selectedBooleantrue: 사용자 인터페이스에 캘린더 일정을 표시하고 false: 일정을 숨깁니다.

리턴

Calendar: 연결용 캘린더

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

setTimeZone(timeZone)

캘린더의 시간대를 설정합니다.

// Gets the user's default calendar. To get a different calendar, use getCalendarById()
// instead.
const calendar = CalendarApp.getDefaultCalendar();

// Sets the time zone of the calendar to America/New York (US/Eastern) time.
calendar.setTimeZone('America/New_York');

매개변수

이름유형설명
timeZoneString'long' 형식으로 지정된 시간대입니다 (예: Joda.org에서 나열한 'America/New_York').

리턴

Calendar - 연결을 위한 캘린더입니다.

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

subscribeToCalendar(id)

사용자에게 구독이 허용된 경우 지정된 ID로 사용자의 캘린더를 구독합니다.

// Subscribe to the calendar "US Holidays".
var calendar = CalendarApp.subscribeToCalendar(
    'en.usa#holiday@group.v.calendar.google.com');
Logger.log('Subscribed to the calendar "%s".', calendar.getName());

매개변수

이름유형설명
idString구독할 캘린더의 ID입니다.

리턴

Calendar - 새로 구독한 캘린더

생성 값

Error: 이 ID를 가진 캘린더가 없는 경우

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds

subscribeToCalendar(id, options)

사용자에게 구독이 허용된 경우 지정된 ID로 사용자의 캘린더를 구독합니다.

// Subscribe to the calendar "US Holidays", and set it to the color blue.
var calendar = CalendarApp.subscribeToCalendar(
    'en.usa#holiday@group.v.calendar.google.com',
    { color: CalendarApp.Color.BLUE });
Logger.log('Subscribed to the calendar "%s".', calendar.getName());

매개변수

이름유형설명
idString구독할 캘린더의 ID입니다.
optionsObject아래에 나열된 고급 매개변수를 지정하는 JavaScript 객체

고급 매개변수

이름유형설명
colorString16진수 색상 문자열 ('#rrggbb') 또는 CalendarApp.Colors의 값
hiddenBoolean캘린더가 사용자 인터페이스에서 숨겨졌는지 여부입니다 (기본값: false).
selectedBoolean캘린더 일정을 사용자 인터페이스에 표시할지 여부 (기본값: true)

리턴

Calendar — 새로 구독한 캘린더

생성 값

Error: 이 ID를 가진 캘린더가 없는 경우

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위에 대한 인증이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • https://www.google.com/calendar/feeds