Class Calendar

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캘린더에서 사용자를 구독 취소합니다.

자세한 문서

createAllDayEvent(title, date)

새 종일 일정을 만듭니다.

// Creates an all-day event for the moon landing and logs the ID.
const 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.
const 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.
const 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.
const 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.
const 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.
const 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

createEvent(title, startTime, endTime)

새 일정을 만듭니다.

시간대가 지정되지 않은 경우 시간 값은 스크립트의 시간대 컨텍스트에서 해석되며, 이는 캘린더의 시간대와 다를 수 있습니다.

// Creates an event for the moon landing and logs the ID.
const 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.
const 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.
const 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.
const 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.
const 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

deleteCalendar()

캘린더를 완전히 삭제합니다. 사용자는 자신이 소유한 캘린더만 삭제할 수 있습니다.

// Creates a calendar to delete.
const calendar = CalendarApp.createCalendar('Test');

// Deletes the 'Test' calendar permanently.
calendar.deleteCalendar();

생성 값

Error: 가져온 캘린더인 경우

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위가 있는 승인이 필요합니다.

  • https://www.googleapis.com/auth/calendar
  • 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

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의 이벤트를 가져옵니다. 시리즈가 기본 캘린더가 아닌 다른 캘린더에 속하는 경우 이 메서드는 해당 캘린더에서 호출해야 합니다. CalendarApp.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의 ID인 경우 CalendarEventSeries가 시리즈의 단일 이벤트와 함께 반환됩니다. 이벤트 시리즈가 기본 캘린더가 아닌 캘린더에 속하는 경우 이 메서드는 해당 Calendar에서 호출해야 합니다. 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.
const now = new Date();
const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000);
const 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)

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

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

author, search 또는 statusFilters의 필터링은 startmax를 적용한 후에 이루어집니다. 즉, 추가 이벤트가 기준을 충족하더라도 반환된 이벤트 수가 max보다 적을 수 있습니다.

// Determines how many events are happening in the next two hours that contain
// the term "meeting".
const now = new Date();
const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000);
const 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)

지정된 날짜에 발생한 모든 활동을 가져옵니다.

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

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

// Determines how many events are happening today.
const today = new Date();
const 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)

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

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

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

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

// Determines how many events are happening today and contain the term
// "meeting".
const today = new Date();
const 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

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: '긴' 형식으로 지정된 시간대입니다 (예: 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

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)

캘린더가 사용자 인터페이스에 표시될지 설정합니다.

매개변수

이름유형설명
hiddenBooleantrue: 사용자 인터페이스에서 캘린더를 숨기고 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'긴' 형식으로 지정된 시간대입니다 (예: Joda.org에 나열된 'America/New_York').

리턴

Calendar: 체이닝을 위한 캘린더입니다.

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위가 있는 승인이 필요합니다.

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

unsubscribeFromCalendar()

캘린더에서 사용자를 구독 취소합니다. 사용자는 내 캘린더 목록에 표시된 캘린더를 수신 거부할 수 없습니다. 다른 캘린더에 나열된 캘린더의 구독을 취소할 수 있습니다.

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

// Unsubscribes the user from the calendar.
const result = calendar.unsubscribeFromCalendar();

생성 값

Error: 소유한 캘린더인 경우

승인

이 메서드를 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 REST API의 적절한 범위가 있는 승인이 필요합니다.

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