Class CalendarEvent

CalendarEvent

단일 캘린더 일정을 나타냅니다.

방법

메서드반환 유형간략한 설명
addEmailReminder(minutesBefore)CalendarEvent일정에 새 이메일 알림을 추가합니다.
addGuest(email)CalendarEvent일정에 참석자를 추가합니다.
addPopupReminder(minutesBefore)CalendarEvent일정에 새 팝업 알림을 추가합니다.
addSmsReminder(minutesBefore)CalendarEvent일정에 새 SMS 알림을 추가합니다.
anyoneCanAddSelf()Boolean사용자가 Calendar 일정에 자신을 참석자로 추가할 수 있는지 결정합니다.
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[]일정의 모든 SMS 알림의 분 값을 가져옵니다.
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이벤트의 공개 상태를 설정합니다.

자세한 문서

addEmailReminder(minutesBefore)

일정에 새 이메일 알림을 추가합니다. 알림은 이벤트 최소 5분 전, 최대 4주 (40,320분) 전이어야 합니다.

// Gets an event by its ID. For an event series, use getEventSeriesById(iCalId) instead.
// TODO(developer): Replace the string with the event ID that you want to get.
const event = CalendarApp.getEventById('abc123456');

// Adds an email notification for 15 minutes before the event.
event.addEmailReminder(15);

매개변수

이름유형설명
minutesBeforeInteger일정까지 남은 시간(분)

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

생성 값

Error - 이벤트에 리마인더가 5개 이상 있거나 시간이 법적 범위 내에 있지 않은 경우

승인

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

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

addGuest(email)

일정에 참석자를 추가합니다.

// Example 1: Add a guest to one event
function addAttendeeToEvent() {
  // Replace the below values with your own
  let attendeeEmail = 'user@example.com'; // Email address of the person you need to add
  let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar containing event
  let eventId = '123abc'; // ID of event instance

  let calendar = CalendarApp.getCalendarById(calendarId);
  if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
    }
  let event = calendar.getEventById(eventId);
  if (event === null) {
    // Event not found
    console.log('Event not found', eventId);
    return;
    }
  event.addGuest(attendeeEmail);
  }

// Example 2: Add a guest to all events on a calendar within a specified timeframe
function addAttendeeToAllEvents(){
// Replace the following values with your own
  let attendeeEmail = 'user@example.com'; // Email address of the person you need to add
  let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar with the events
  let startDate = new Date("YYYY-MM-DD"); // The first date to add the guest to the events
  let endDate = new Date("YYYY-MM-DD"); // The last date to add the guest to the events

  let calendar = CalendarApp.getCalendarById(calendarId);
    if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
  }
  // Get the events within the specified timeframe
  let calEvents = calendar.getEvents(startDate,endDate);
  console.log(calEvents.length); // Checks how many events are found
  // Loop through all events and add the attendee to each of them
  for (var i = 0; i < calEvents.length; i++) {
  let event = calEvents[i];
  event.addGuest(attendeeEmail);
  }
}

매개변수

이름유형설명
emailString참석자의 이메일 주소입니다.

리턴

CalendarEvent: 체이닝을 위한 CalendarEvent입니다.

승인

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

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

addPopupReminder(minutesBefore)

일정에 새 팝업 알림을 추가합니다. 알림은 이벤트 최소 5분 전, 최대 4주 (40,320분) 전에 전송되어야 합니다.

// Gets an event by its ID. For an event series, use getEventSeriesById(iCalId) instead.
// TODO(developer): Replace the string with the event ID that you want to get.
const event = CalendarApp.getEventById('abc123456');

// Adds a pop-up notification for 15 minutes before the event.
event.addPopupReminder(15);

매개변수

이름유형설명
minutesBeforeInteger일정까지 남은 시간(분)

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

addSmsReminder(minutesBefore)

일정에 새 SMS 알림을 추가합니다. 알림은 이벤트 최소 5분 전, 최대 4주 (40,320분) 전이어야 합니다.

매개변수

이름유형설명
minutesBeforeInteger일정까지 남은 시간(분)

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

생성 값

Error - 이벤트에 리마인더가 5개 이상 있거나 시간이 법적 범위 내에 있지 않은 경우

승인

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

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

anyoneCanAddSelf()

사용자가 Calendar 일정에 자신을 참석자로 추가할 수 있는지 결정합니다.

// Gets an event by its ID. For an event series, use getEventSeriesById(iCalId) instead.
// TODO(developer): Replace the string with the event ID that you want to get.
const event = CalendarApp.getEventById('abc123456');

// Determines whether people can add themselves as guests to the event and logs it.
console.log(event.anyoneCanAddSelf());

리턴

Boolean: 참석자가 아닌 사람이 일정에 추가할 수 있는 경우 true, 추가할 수 없는 경우 false입니다.

승인

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

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

deleteEvent()

캘린더 일정을 삭제합니다.

// Gets an event by its ID.
// TODO(developer): Replace the string with the ID of the event that you want to delete.
const event = CalendarApp.getEventById('abc123456');

// Deletes the event.
event.deleteEvent();

승인

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

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

deleteTag(key)

이벤트에서 키/값 태그를 삭제합니다.

매개변수

이름유형설명
keyString태그 키

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

getAllDayEndDate()

종일 캘린더 일정이 종료되는 날짜를 가져옵니다. (종일 이벤트가 아니면 이 메서드에서 예외가 발생합니다.) 반환된 Date스크립트의 시간대로 이벤트가 종료된 후 하루가 시작되는 날의 자정을 나타냅니다. 캘린더의 시간대를 대신 사용하려면 getEndTime()를 호출하세요.

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

// Creates an event named 'My all-day event' for May 16, 2023.
const event = calendar.createAllDayEvent('My all-day event', new Date('May 16, 2023'));

// Gets the event's end date and logs it.
const endDate = event.getAllDayEndDate();
console.log(endDate);

리턴

Date: 종일 캘린더 일정의 종료일

생성 값

Error: 이 일정이 종일 일정이 아닌 경우

승인

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

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

getAllDayStartDate()

종일 캘린더 일정이 시작되는 날짜를 가져옵니다. (종일 이벤트가 아니면 이 메서드에서 예외가 발생합니다.) 반환된 Date스크립트의 시간대로 이벤트가 시작되는 날의 자정을 나타냅니다. 캘린더의 시간대를 대신 사용하려면 getStartTime()를 호출하세요.

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

// Creates an event named 'My all-day event' for May 16, 2023.
const event = calendar.createAllDayEvent('My all-day event', new Date('May 16, 2023'));

// Gets the event's start date and logs it.
const startDate = event.getAllDayStartDate();
console.log(startDate);

리턴

Date — 종일 캘린더 일정의 시작일

생성 값

Error: 이 일정이 종일 일정이 아닌 경우

승인

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

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

getAllTagKeys()

이벤트에 설정된 태그의 모든 키를 가져옵니다.

리턴

String[]: 문자열 키 배열

승인

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

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

getColor()

캘린더 이벤트의 색상을 반환합니다.

// Gets an event by its ID. For an event series, use getEventSeriesById(iCalId) instead.
// TODO(developer): Replace the string with the event ID that you want to get.
const event = CalendarApp.getEventById('abc123456');

// Gets the color of the calendar event and logs it.
const eventColor = event.getColor();
console.log(eventColor);

리턴

String - CalendarApp.EventColor 값의 색인 (1~11)으로 표현된 이벤트 색상을 문자열 표현한 것입니다.

승인

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

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

getCreators()

이벤트 제작자를 가져옵니다.

// Gets an event by its ID. For an event series, use getEventSeriesById(iCalId) instead.
// TODO(developer): Replace the string with the event ID that you want to get.
const event = CalendarApp.getEventById('abc123456');

// Gets a list of the creators of the event and logs it.
console.log(event.getCreators());

리턴

String[] — 이벤트 작성자의 이메일 주소입니다.

승인

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

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

getDateCreated()

이벤트가 생성된 날짜를 가져옵니다. 캘린더에 액세스할 수 있어야 합니다.

// Opens the calendar by using its ID.
// To get the user's default calendar use CalendarApp.getDefault() instead.
// TODO(developer): Replace the calendar ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 8:10 AM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 08:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, gets the date that the event
 // was created and logs it.
 const eventCreated = event.getDateCreated();
 console.log(eventCreated);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Date: 생성 날짜

승인

이 방법을 사용하는 스크립트에는 다음 범위 중 하나 이상 또는 관련 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.
// To get the user's default calendar use CalendarApp.getDefault() instead.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 4th, 2023 that takes place
between 4:00 PM and 5:00 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 04, 2023 16:00:00'), new Date('Feb 04, 2023 17:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the description of the event.
 event.setDescription('Important meeting');

 // Gets the description of the event and logs it.
 const description = event.getDescription();
 console.log(description);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

String: 설명

승인

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

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

getEmailReminders()

일정에 대한 모든 이메일 알림의 분 값을 가져옵니다. 캘린더에 대한 수정 액세스 권한이 있어야 합니다.

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

// Gets the first event from the calendar for February 4th, 2023 that takes place
between 5:00 PM and 6:00 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 04, 2023 15:00:00'), new Date('Feb 04, 2023 18:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, adds email reminders for the user to be
 // sent at 4 and 7 minutes before the event.
 event.addEmailReminder(4);
 event.addEmailReminder(7);

 // Gets the minute values for all email reminders that are set up for the user for this event
 // and logs it.
 const emailReminder = event.getEmailReminders();
 console.log(emailReminder);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Integer[] - 리마인더가 트리거하는 이벤트 전 시간(분)에 각 값이 해당하는 배열

승인

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

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

getEndTime()

이 캘린더 일정이 종료되는 날짜와 시간을 가져옵니다. 캘린더에 액세스할 수 있어야 합니다. 종일이 아닌 이벤트의 경우 이벤트가 종료되도록 정의된 시점입니다. 날짜 및 시간이 아닌 종료일만 저장하는 종일 일정의 경우 캘린더 시간대를 기준으로 일정 종료 다음 날의 자정을 기준으로 합니다. 이렇게 하면 모든 이벤트 유형의 종료 시간을 의미 있게 비교할 수 있습니다. 하지만 원래 날짜를 수정되지 않은 상태로 보존할 필요는 없습니다.

종일 이벤트의 경우 거의 항상 이 메서드보다 getAllDayEndDate()가 호출되어야 합니다.

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

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:00 PM and 5:00 PM.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:00:00'), new Date('Feb 01, 2023 17:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, gets the date and time at which the
 // event ends and logs it.
 console.log(event.getEndTime());
} else {
 // If no event exists within the given time frame, logs that info to the console.
 console.log('No events exist for the specified range');
}

리턴

Date — 이 캘린더 일정의 종료 시간

승인

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

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

getEventSeries()

이 일정이 속한 반복 일정을 가져옵니다. 캘린더에 대한 액세스 권한이 있어야 합니다. 이벤트가 시리즈에 속하지 않더라도 CalendarEventSeries 객체가 반환되므로 새 반복 설정을 추가할 수 있습니다.

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

// Gets the first event from the calendar for February 18th, 2023 that takes place between
// 1:00 PM and 2:00 PM.
const event =
  calendar.getEvents(new Date('Feb 18, 2023 13:00:00'), new Date('Feb 18, 2023 14:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, gets the event series for the event
 // and sets the color to pale green.
 event.getEventSeries().setColor(CalendarApp.EventColor.PALE_GREEN);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

CalendarEventSeries - 이 이벤트가 속한 이벤트 시리즈 또는 새 이벤트 시리즈(아직 시리즈에 속하지 않는 경우)

승인

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

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

getGuestByEmail(email)

이메일 주소로 참석자를 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 25th, 2023 that takes place
// between 5:00 PM and 5:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 25,2023 17:00:00'), new Date('Feb 25,2023 17:25:00'))[0];

// Gets a guest by email address.
const guestEmailId = event.getGuestByEmail('alex@example.com');

// If the email address corresponds to an event guest, logs the email address.
if (guestEmailId) {
  console.log(guestEmailId.getEmail());
}

매개변수

이름유형설명
emailString게스트의 주소

리턴

EventGuest — 게스트 또는 이메일 주소가 게스트와 일치하지 않는 경우 null입니다.

승인

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

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

getGuestList()

일정 소유자를 제외한 일정의 참석자를 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 25th, 2023 that takes place
// between 5:00 PM and 5:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 25,2023 17:00:00'), new Date('Feb 25,2023 17:25:00'))[0];

// Adds two guests to the event by using their email addresses.
event.addGuest('alex@example.com');
event.addGuest('cruz@example.com');

// Gets the guests list for the event.
const guestList = event.getGuestList();

// Loops through the list to get all the guests and logs their email addresses.
for (const guest of guestList){
  console.log(guest.getEmail());
}

리턴

EventGuest[]: 참석자의 배열

승인

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

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

getGuestList(includeOwner)

이벤트 소유자를 포함하여 이벤트의 참석자를 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 25th, 2023 that takes place
// between 5:00 PM and 5:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 25,2023 17:00:00'), new Date('Feb 25,2023 17:25:00'))[0];

// Gets the guests list for the event, including the owner of the event.
const guestList = event.getGuestList(true);

// Loops through the list to get all the guests and logs it.
for (const guest of guestList) {
  console.log(guest.getEmail());
}

매개변수

이름유형설명
includeOwnerBoolean소유자를 게스트로 포함할지 여부

리턴

EventGuest[]: 참석자의 배열

승인

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

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

getId()

이벤트의 고유 iCalUID를 가져옵니다. Calendar v3 APICalendar 고급 서비스에서 사용하는 iCalUID와 이벤트 id는 동일하지 않으며 서로 바꿔서 사용할 수 없습니다. 시맨틱스의 한 가지 차이점은 반복 이벤트에서 한 이벤트가 모두 발생하지만 ids은 모두 다르지만 모두 동일한 iCalUID를 공유한다는 것입니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for January 5th, 2023 that takes place
// between 9:00 AM and 9:25 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Jan 05, 2023 09:00:00'), new Date('Jan 05, 2023 09:25:00'))[0];

// Gets the ID of the event and logs it.
console.log(event.getId());

리턴

String: 이벤트의 iCalUID

승인

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

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

getLastUpdated()

이벤트가 마지막으로 업데이트된 날짜를 가져옵니다.

// Opens the calendar by its ID. You must have view access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
between 4:00 PM and 5:00 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:00:00'), new Date('Feb 01, 2023 17:00:00'))[0];

// Gets the date the event was last updated and logs it.
const eventUpdatedDate = event.getLastUpdated();
console.log(eventUpdatedDate);

리턴

Date: 최종 업데이트 날짜

승인

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

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

getLocation()

이벤트의 위치를 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the location of the event to Mumbai.
 event.setLocation('Mumbai');

 // Gets the location of the event and logs it.
 const eventLocation = event.getLocation();
 console.log(eventLocation);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

String: 일정 위치

승인

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

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

getMyStatus()

유효 사용자의 이벤트 상태 (예: 참석 또는 초대됨)를 가져옵니다. 유효 사용자가 이벤트의 소유자인 경우 항상 GuestStatus.OWNER를 반환합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, gets the event status of
 // the effective user and logs it.
 const myStatus = event.getMyStatus();
 console.log(myStatus.toString());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

GuestStatus: 상태

승인

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

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

getOriginalCalendarId()

이 일정이 원래 생성된 캘린더의 ID를 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 25th, 2023 that takes place
// between 4:00 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 25,2023 16:00:00'), new Date('Feb 25,2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, gets the ID of the calendar where the
 // event was originally created and logs it.
 const calendarId = event.getOriginalCalendarId();
 console.log(calendarId);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

String: 원래 캘린더의 ID

승인

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

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

getPopupReminders()

일정의 모든 팝업 알림에 대한 분 값을 가져옵니다.

  // Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 4th, 2023 that takes place
// between 5:05 PM and 5:35 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 04, 2023 17:05:00'), new Date('Feb 04, 2023 17:35:00'))[0];

if (event) {
 // If an event exists within the given time frame, adds two pop-up reminders to the event.
 // The first reminder pops up 5 minutes before the event starts and the second reminder
 // pops up 3 minutes before the event starts.
 event.addPopupReminder(3);
 event.addPopupReminder(5);

 // Gets the minute values for all pop-up reminders for the event and logs it.
 const popUpReminder = event.getPopupReminders();
 console.log(popUpReminder);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Integer[] - 리마인더가 트리거하는 이벤트 전 시간(분)에 각 값이 해당하는 배열

승인

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

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

getSmsReminders()

일정의 모든 SMS 알림의 분 값을 가져옵니다.

리턴

Integer[] - 리마인더가 트리거하는 이벤트 전 시간(분)에 각 값이 해당하는 배열

승인

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

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

getStartTime()

이 캘린더 일정이 시작되는 날짜와 시간을 가져옵니다. 종일이 아닌 이벤트의 경우 이벤트가 시작되도록 정의된 시점입니다. 날짜 및 시간이 아닌 시작일만 저장하는 종일 이벤트의 경우, 캘린더 시간대로 이벤트가 시작되는 하루가 시작되는 날의 자정입니다. 이렇게 하면 모든 이벤트 유형의 시작 시간을 의미 있게 비교할 수 있지만 원래 날짜를 수정되지 않은 상태로 보존할 수 있는 것은 아닙니다.

종일 이벤트의 경우 getAllDayStartDate()은 거의 항상 이 메서드에 우선하여 호출됩니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

// Gets the date and time at which this calendar event begins and logs it.
const startTime = event.getStartTime();
console.log(startTime);

리턴

Date — 이 캘린더 일정의 시작 시간

승인

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

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

getTag(key)

이벤트의 태그 값을 가져옵니다.

매개변수

이름유형설명
keyString

리턴

String: 태그 값

승인

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

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

getTitle()

이벤트 제목을 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for January 31st, 2023 that takes place
// between 9:05 AM and 9:15 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'))[0];

if (event) {
 // If an event exists within the given time frame, logs the title of the event.
 console.log(event.getTitle());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

String: 제목

승인

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

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

getVisibility()

이벤트의 공개 상태를 가져옵니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, gets the visibility of the event
 // and logs it.
 const eventVisibility = event.getVisibility();
 console.log(eventVisibility.toString());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Visibility: 공개 상태 값

승인

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

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

guestsCanInviteOthers()

게스트가 다른 참석자를 초대할 수 있는지 여부를 결정합니다.

// Opens the calendar by its ID. You must have view access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 9:35 AM and 9:40 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 09:35:00'), new Date('Feb 01, 2023 09:40:00'))[0];

if (event) {
 // If an event exists within the given time frame, determines whether guests can invite
 // other guests and logs it.
 console.log(event.guestsCanInviteOthers());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Boolean - 참석자가 다른 사람을 초대할 수 있는 경우 true, 그렇지 않으면 false

승인

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

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

guestsCanModify()

참석자가 일정을 수정할 수 있는지 여부를 결정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 9:35 AM and 9:40 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 09:35:00'), new Date('Feb 01, 2023 09:40:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the event so that guests can't
 // modify it.
 event.setGuestsCanModify(false);

 // Determines whether guests can modify the event and logs it.
 console.log(event.guestsCanModify());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Boolean: 참석자가 일정을 수정할 수 있는 경우 true, 수정할 수 없는 경우 false입니다.

승인

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

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

guestsCanSeeGuests()

참석자가 다른 참석자를 볼 수 있는지 여부를 결정합니다.

// Opens the calendar by its ID. You must have view access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 9:35 AM and 9:40 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 09:35:00'), new Date('Feb 01, 2023 09:40:00'))[0];

if (event) {
 // If an event exists within the given time frame, determines whether guests can see other
 // guests and logs it.
 console.log(event.guestsCanSeeGuests());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Boolean: 참석자가 다른 참석자를 볼 수 있으면 true, 그렇지 않으면 false

승인

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

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

isAllDayEvent()

종일 일정인지 확인합니다.

// Opens the calendar by its ID. You must have view access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for January 31st, 2023 that takes place
// between 9:05 AM and 9:15 AM.
const event =
  calendar.getEvents(new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'))[0];

// Determines whether this event is an all-day event and logs it.
console.log(event.isAllDayEvent());

리턴

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()

내가 일정의 소유자인지 확인합니다.

// Opens the calendar by its ID. You must have view access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for January 31st, 2023 that takes place
// between 9:05 AM and 9:15 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'))[0];

if (event) {
 // If an event exists within the given time frame, determines whether you're the owner
 // of the event and logs it.
 console.log(event.isOwnedByMe());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Boolean - 유효 사용자가 이벤트를 소유하는 경우 true, 소유하지 않은 경우 false

승인

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

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

isRecurringEvent()

일정이 일정 반복의 일부인지 확인합니다.

// Opens the calendar by its ID. You must have view access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for Januart 31st, 2023 that takes place
// between 9:00 AM and 10:00 AM.
const event =
  calendar.getEvents(new Date('Jan 31, 2023 09:00:00'), new Date('Jan 31, 2023 10:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, determines whether the event is part of an
 // event series and logs it.
 console.log(event.isRecurringEvent());
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

Boolean: 이벤트가 이벤트 시리즈의 일부인 경우 true, 그렇지 않은 경우 false

승인

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

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

removeAllReminders()

일정에서 모든 알림을 삭제합니다.

// Opens the calendar by its ID. You must have edit access to the calendar
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 1,2023 16:10:00'), new Date('Feb 1,2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, removes all reminders from the event.
 event.removeAllReminders();
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

removeGuest(email)

일정에서 참석자를 삭제합니다.

// Example 1: Remove a guest from one event
function removeGuestFromEvent() {
  // Replace the below values with your own
  let attendeeEmail = 'user@example.com'; // Email address of the person you need to remove
  let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar containing event
  let eventId = '123abc'; // ID of event instance

  let calendar = CalendarApp.getCalendarById(calendarId);
  if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
    }
  let event = calendar.getEventById(eventId);
  if (event === null) {
    // Event not found
    console.log('Event not found', eventId);
    return;
    }
  event.removeGuest(attendeeEmail);
  }

// Example 2: Remove a guest from all events on a calendar within a specified timeframe
function removeGuestFromAllEvents(){
// Replace the following values with your own
  let attendeeEmail = 'user@example.com'; // Email address of the person you need to remove
  let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar with the events
  let startDate = new Date("YYYY-MM-DD"); // The first date to remove the guest from the events
  let endDate = new Date("YYYY-MM-DD"); // The last date to remove the attendee from the events

  let calendar = CalendarApp.getCalendarById(calendarId);
    if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
  }
  // Get the events within the specified timeframe
  let calEvents = calendar.getEvents(startDate,endDate);
  console.log(calEvents.length); // Checks how many events are found
  // Loop through all events and remove the attendee from each of them
  for (var i = 0; i < calEvents.length; i++) {
  let event = calEvents[i];
  event.removeGuest(attendeeEmail);
  }
}

매개변수

이름유형설명
emailString게스트의 이메일 주소

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

resetRemindersToDefault()

캘린더의 기본 설정을 사용하여 알림을 재설정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 1, 2023 16:10:00'), new Date('Feb 1, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, resets the reminders using the calendar's
 // default settings.
 event.resetRemindersToDefault();
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setAllDayDate(date)

이벤트 날짜를 설정합니다. 이 메서드를 적용하면 일반 일정이 종일 일정으로 변경됩니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 17th, 2023 that takes place
// between 4:00 PM and 5:00 PM.
const event =
  calendar.getEvents(new Date('Feb 17, 2023 16:00:00'), new Date('Feb 17, 2023 17:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the date of the event and updates
 // it to an all-day event.
 event.setAllDayDate(new Date('Feb 17, 2023'));
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
dateDate이벤트 날짜 (시간은 무시됨)

리턴

CalendarEvent: 연결을 위한 이 CalendarEvent

승인

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

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

setAllDayDates(startDate, endDate)

이벤트 날짜를 설정합니다. 이 메서드를 적용하면 일반 이벤트가 종일 이벤트로 변경됩니다.

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

// Gets the first event from the calendar for February 18th, 2023 that takes place
// between 4:00 PM and 5:00 PM.
const event =
  calendar.getEvents(new Date('Feb 18, 2023 16:00:00'), new Date('Feb 18, 2023 17:00:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the event to be an all-day event from
 // Feb 18th, 2023 until Feb 25th, 2023. Applying this method changes a regular event into an
 // all-day event.
 event.setAllDayDates(new Date('Feb 18, 2023'), new Date('Feb 25, 2023'));
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
startDateDate이벤트가 시작되는 날짜 (시간은 무시됨)
endDateDate이벤트가 종료되는 날짜 (시간은 무시됨)

리턴

CalendarEvent: 연결을 위한 이 CalendarEvent

승인

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

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

setAnyoneCanAddSelf(anyoneCanAddSelf)

참석자가 아닌 사람이 일정에 자신을 추가할 수 있는지 여부를 설정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 15th, 2023 that takes place
// between 3:30 PM and 4:30 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 15, 2023 15:30:00'), new Date('Feb 15, 2023 16:30:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the event so that non-guests
 // can't add themselves to the event.
 event.setAnyoneCanAddSelf(false);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
anyoneCanAddSelfBoolean누구나 자신을 초대할 수 있는지 여부

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setColor(color)

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

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the color of the calendar event to
 // green.
 event.setColor(CalendarApp.EventColor.GREEN);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
colorString문자열 형식의 정수 색상 색인 또는 CalendarApp.EventColor의 값입니다.

리턴

CalendarEvent - 연결을 위한 이 캘린더 이벤트입니다.

승인

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

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

setDescription(description)

이벤트 설명을 설정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 4th, 2023 that takes place
// between 5:05 PM and 5:35 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 04, 2023 17:05:00'), new Date('Feb 04, 2023 17:35:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the description of the event to
 // 'Meeting.'
 event.setDescription('Meeting');
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
descriptionString새 설명

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setGuestsCanInviteOthers(guestsCanInviteOthers)

게스트가 다른 참석자를 초대할 수 있는지 여부를 설정합니다.

// Opens the calendar by its ID.
// TODO(developer): Replace the ID with your own. You must have edit access to the calendar.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 9:35 AM and 9:40 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 09:35:00'), new Date('Feb 01, 2023 09:40:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the event so that guests can invite
 // other guests.
 event.setGuestsCanInviteOthers(true);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
guestsCanInviteOthersBoolean참석자가 다른 사용자를 초대할 수 있는지 여부

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setGuestsCanModify(guestsCanModify)

참석자가 일정을 수정할 수 있는지 여부를 설정합니다.

매개변수

이름유형설명
guestsCanModifyBoolean참석자가 일정을 수정할 수 있는지 여부

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setGuestsCanSeeGuests(guestsCanSeeGuests)

게스트가 다른 참석자를 볼 수 있는지 여부를 설정합니다.

매개변수

이름유형설명
guestsCanSeeGuestsBoolean참석자가 다른 사용자를 볼 수 있는지 여부

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setLocation(location)

이벤트의 위치를 설정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the location of the event to Noida.
 event.setLocation('Noida');
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
locationString새 위치

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setMyStatus(status)

유효 사용자의 이벤트 상태 (예: 참석 또는 초대됨)를 설정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for February 1st, 2023 that takes place
// between 4:10 PM and 4:25 PM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'))[0];

if (event) {
 // If an event exists within the given time frame, sets the event status for the current user
 to maybe.
 event.setMyStatus(CalendarApp.GuestStatus.MAYBE);
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
statusGuestStatus새 상태

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setTag(key, value)

커스텀 메타데이터를 저장하기 위한 키/값 태그를 이벤트에 설정합니다.

매개변수

이름유형설명
keyString태그 키
valueString태그 값

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setTime(startTime, endTime)

이벤트 시작 및 종료 날짜와 시간을 설정합니다. 이 메서드를 적용하면 종일 이벤트가 일반 이벤트로 변경됩니다.

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

// Declares a start time of 11:00 AM on February 20th, 2023 and an end time of 12:00 PM on
// February 20th, 2023.
const startTime = new Date('Feb 20,2023 11:00:00');
const endTime = new Date('Feb 20, 2023  12:00:00');

// Creates an all-day event on February 20th, 2023.
const event = calendar.createAllDayEvent('Meeting', new Date('Feb 20,2023'));

// Updates the all-day event to a regular event by setting a start and end time for the event.
event.setTime(startTime, endTime);

매개변수

이름유형설명
startTimeDate일정의 새로운 시작
endTimeDate일정의 새로운 종료

리턴

CalendarEvent: 연결을 위한 이 CalendarEvent

승인

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

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

setTitle(title)

이벤트 제목을 설정합니다.

// Opens the calendar by its ID. You must have edit access to the calendar.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('abc123456@group.calendar.google.com');

// Gets the first event from the calendar for January 31st, 2023 that takes place
// between 9:05 AM and 9:15 AM.
// For an event series, use calendar.getEventSeriesById('abc123456@google.com');
// and replace the series ID with your own.
const event =
  calendar.getEvents(new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'))[0];

if (event) {
 // If an event exists within the given time frame, changes its title to Event1.
 event.setTitle('Event1');
} else {
 // If no event exists within the given time frame, logs that information to the console.
 console.log('No events exist for the specified range');
}

매개변수

이름유형설명
titleString새 제목

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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

setVisibility(visibility)

이벤트의 공개 상태를 설정합니다.

매개변수

이름유형설명
visibilityVisibility

리턴

CalendarEvent: 이 CalendarEvent는 체이닝을 위한 것입니다.

승인

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

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