Class CalendarEventSeries

CalendarEventSeries

Đại diện cho một chuỗi sự kiện (một sự kiện định kỳ).

Phương thức

Phương thứcKiểu dữ liệu trả vềMô tả ngắn
addEmailReminder(minutesBefore)CalendarEventSeriesThêm lời nhắc mới qua email vào sự kiện.
addGuest(email)CalendarEventSeriesThêm khách vào sự kiện.
addPopupReminder(minutesBefore)CalendarEventSeriesThêm thông báo bật lên mới vào sự kiện.
addSmsReminder(minutesBefore)CalendarEventSeriesThêm lời nhắc SMS mới vào sự kiện.
anyoneCanAddSelf()BooleanXác định xem mọi người có thể tự thêm mình làm khách vào một sự kiện trên Lịch hay không.
deleteEventSeries()voidXoá chuỗi sự kiện.
deleteTag(key)CalendarEventSeriesXoá thẻ khoá/giá trị khỏi sự kiện.
getAllTagKeys()String[]Lấy tất cả khoá của những thẻ đã được đặt cho sự kiện.
getColor()StringTrả về màu của sự kiện trên lịch.
getCreators()String[]Xem người tạo sự kiện.
getDateCreated()DateLấy ngày tạo sự kiện.
getDescription()StringLấy nội dung mô tả về sự kiện.
getEmailReminders()Integer[]Lấy giá trị phút cho tất cả lời nhắc qua email về sự kiện.
getGuestByEmail(email)EventGuestMời khách qua địa chỉ email.
getGuestList()EventGuest[]Nhận khách tham dự sự kiện, không bao gồm chủ sở hữu sự kiện.
getGuestList(includeOwner)EventGuest[]Nhận khách tham dự sự kiện, có thể bao gồm cả chủ sở hữu sự kiện.
getId()StringLấy iCalUID duy nhất của sự kiện.
getLastUpdated()DateLấy ngày cập nhật sự kiện lần gần đây nhất.
getLocation()StringLấy vị trí của sự kiện.
getMyStatus()GuestStatusNhận trạng thái sự kiện (chẳng hạn như đang tham dự hoặc được mời) của người dùng có hiệu lực.
getOriginalCalendarId()StringLấy mã lịch nơi sự kiện này được tạo ban đầu.
getPopupReminders()Integer[]Lấy giá trị phút cho tất cả lời nhắc bật lên về sự kiện.
getSmsReminders()Integer[]Nhận giá trị phút cho tất cả lời nhắc qua SMS về sự kiện.
getTag(key)StringNhận giá trị thẻ của sự kiện.
getTitle()StringLấy tiêu đề của sự kiện.
getVisibility()VisibilityXem chế độ hiển thị của sự kiện.
guestsCanInviteOthers()BooleanXác định xem khách có thể mời những khách khác hay không.
guestsCanModify()BooleanXác định xem khách có thể chỉnh sửa sự kiện hay không.
guestsCanSeeGuests()BooleanXác định xem khách có thể nhìn thấy khách khác hay không.
isOwnedByMe()BooleanXác định xem bạn có phải là chủ sở hữu sự kiện hay không.
removeAllReminders()CalendarEventSeriesXoá tất cả lời nhắc khỏi sự kiện.
removeGuest(email)CalendarEventSeriesXoá khách khỏi sự kiện.
resetRemindersToDefault()CalendarEventSeriesĐặt lại lời nhắc bằng chế độ cài đặt mặc định của lịch.
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEventSeriesThiết lập liệu những khách không phải khách có thể tự thêm chính mình vào sự kiện hay không.
setColor(color)CalendarEventSeriesĐặt màu cho sự kiện trên lịch.
setDescription(description)CalendarEventSeriesĐặt nội dung mô tả sự kiện.
setGuestsCanInviteOthers(guestsCanInviteOthers)CalendarEventSeriesĐặt xem khách có thể mời những khách khác hay không.
setGuestsCanModify(guestsCanModify)CalendarEventSeriesĐặt xem khách có thể sửa đổi sự kiện hay không.
setGuestsCanSeeGuests(guestsCanSeeGuests)CalendarEventSeriesThiết lập liệu khách có thể nhìn thấy những khách khác hay không.
setLocation(location)CalendarEventSeriesThiết lập vị trí của sự kiện.
setMyStatus(status)CalendarEventSeriesĐặt trạng thái sự kiện (chẳng hạn như đang tham dự hoặc được mời) của người dùng có hiệu lực.
setRecurrence(recurrence, startDate)CalendarEventSeriesĐặt quy tắc lặp lại cho một chuỗi sự kiện cả ngày.
setRecurrence(recurrence, startTime, endTime)CalendarEventSeriesĐặt quy tắc lặp lại cho chuỗi sự kiện này.
setTag(key, value)CalendarEventSeriesĐặt thẻ khoá/giá trị cho sự kiện để lưu trữ siêu dữ liệu tuỳ chỉnh.
setTitle(title)CalendarEventSeriesĐặt tiêu đề của sự kiện.
setVisibility(visibility)CalendarEventSeriesThiết lập chế độ hiển thị của sự kiện.

Tài liệu chi tiết

addEmailReminder(minutesBefore)

Thêm lời nhắc mới qua email vào sự kiện. Lời nhắc phải ít nhất 5 phút và tối đa là 4 tuần (40320 phút) trước sự kiện.

// 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);

Các tham số

TênLoạiNội dung mô tả
minutesBeforeIntegersố phút trước sự kiện

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Gửi

Error — nếu sự kiện có nhiều hơn 5 lời nhắc hoặc thời gian không nằm trong phạm vi pháp lý

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

addGuest(email)

Thêm khách vào sự kiện.

// 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);
  }
}

Các tham số

TênLoạiNội dung mô tả
emailStringĐịa chỉ email của khách.

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi.

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

addPopupReminder(minutesBefore)

Thêm thông báo bật lên mới vào sự kiện. Thông báo phải xuất hiện trước sự kiện ít nhất 5 phút và tối đa là 4 tuần (40320 phút).

// 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);

Các tham số

TênLoạiNội dung mô tả
minutesBeforeIntegersố phút trước sự kiện

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

addSmsReminder(minutesBefore)

Thêm lời nhắc SMS mới vào sự kiện. Lời nhắc phải ít nhất 5 phút và tối đa là 4 tuần (40320 phút) trước sự kiện.

Các tham số

TênLoạiNội dung mô tả
minutesBeforeIntegersố phút trước sự kiện

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Gửi

Error — nếu sự kiện có nhiều hơn 5 lời nhắc hoặc thời gian không nằm trong phạm vi pháp lý

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

anyoneCanAddSelf()

Xác định xem mọi người có thể tự thêm mình làm khách vào một sự kiện trên Lịch hay không.

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

Cầu thủ trả bóng

Booleantrue nếu khách không phải khách có thể tự thêm mình vào sự kiện; false nếu không phải

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

deleteEventSeries()

Xoá chuỗi sự kiện.

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

deleteTag(key)

Xoá thẻ khoá/giá trị khỏi sự kiện.

Các tham số

TênLoạiNội dung mô tả
keyStringkhoá thẻ

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getAllTagKeys()

Lấy tất cả khoá của những thẻ đã được đặt cho sự kiện.

Cầu thủ trả bóng

String[] – một mảng các khoá chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getColor()

Trả về màu của sự kiện trên lịch.

// 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);

Cầu thủ trả bóng

String – Chuỗi đại diện của màu sự kiện, dưới dạng chỉ mục (1-11) của các giá trị từ CalendarApp.EventColor.

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getCreators()

Xem người tạo sự kiện.

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

Cầu thủ trả bóng

String[] — địa chỉ email của người tạo sự kiện

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getDateCreated()

Lấy ngày tạo sự kiện. Bạn phải có quyền truy cập vào lịch.

// 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');
}

Cầu thủ trả bóng

Date – ngày tạo

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getDescription()

Lấy nội dung mô tả về sự kiện. Bạn phải có quyền chỉnh sửa lịch.

// 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');
}

Cầu thủ trả bóng

String — mô tả

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getEmailReminders()

Lấy giá trị phút cho tất cả lời nhắc qua email về sự kiện. Bạn phải có quyền chỉnh sửa lịch.

// 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');
}

Cầu thủ trả bóng

Integer[] – một mảng trong đó mỗi giá trị tương ứng với số phút trước sự kiện mà một lời nhắc kích hoạt

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getGuestByEmail(email)

Mời khách qua địa chỉ 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());
}

Các tham số

TênLoạiNội dung mô tả
emailStringđịa chỉ của khách

Cầu thủ trả bóng

EventGuest – khách hoặc để trống nếu địa chỉ email không tương ứng với khách

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getGuestList()

Nhận khách tham dự sự kiện, không bao gồm chủ sở hữu sự kiện.

// 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());
}

Cầu thủ trả bóng

EventGuest[] – một mảng khách

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getGuestList(includeOwner)

Nhận khách tham dự sự kiện, có thể bao gồm cả chủ sở hữu sự kiện.

// 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());
}

Các tham số

TênLoạiNội dung mô tả
includeOwnerBooleancó bao gồm chủ sở hữu làm khách hay không

Cầu thủ trả bóng

EventGuest[] – một mảng khách

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getId()

Lấy iCalUID duy nhất của sự kiện. Xin lưu ý rằng iCalUID và sự kiện idAPI Lịch phiên bản 3dịch vụ nâng cao của Lịch sử dụng không giống nhau và không thể dùng thay thế cho nhau. Một điểm khác biệt về ngữ nghĩa là trong các sự kiện định kỳ, tất cả các lần xuất hiện của một sự kiện đều có ids khác nhau trong khi tất cả đều có cùng 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());

Cầu thủ trả bóng

String – iCalUID của sự kiện

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getLastUpdated()

Lấy ngày cập nhật sự kiện lần gần đây nhất.

// 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);

Cầu thủ trả bóng

Date — ngày cập nhật gần đây nhất

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getLocation()

Lấy vị trí của sự kiện.

// 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');
}

Cầu thủ trả bóng

String — địa điểm diễn ra sự kiện

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getMyStatus()

Nhận trạng thái sự kiện (chẳng hạn như đang tham dự hoặc được mời) của người dùng có hiệu lực. Luôn trả về GuestStatus.OWNER nếu người dùng hiệu quả là chủ sở hữu của sự kiện.

// 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');
}

Cầu thủ trả bóng

GuestStatus – trạng thái

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getOriginalCalendarId()

Lấy mã lịch nơi sự kiện này được tạo ban đầu.

// 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');
}

Cầu thủ trả bóng

String — mã của lịch gốc

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getPopupReminders()

Lấy giá trị phút cho tất cả lời nhắc bật lên về sự kiện.

  // 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');
}

Cầu thủ trả bóng

Integer[] – một mảng trong đó mỗi giá trị tương ứng với số phút trước sự kiện mà một lời nhắc kích hoạt

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getSmsReminders()

Nhận giá trị phút cho tất cả lời nhắc qua SMS về sự kiện.

Cầu thủ trả bóng

Integer[] – một mảng trong đó mỗi giá trị tương ứng với số phút trước sự kiện mà một lời nhắc kích hoạt

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getTag(key)

Nhận giá trị thẻ của sự kiện.

Các tham số

TênLoạiNội dung mô tả
keyStringkhoá

Cầu thủ trả bóng

String – giá trị thẻ

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getTitle()

Lấy tiêu đề của sự kiện.

// 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');
}

Cầu thủ trả bóng

String – tiêu đề

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

getVisibility()

Xem chế độ hiển thị của sự kiện.

// 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');
}

Cầu thủ trả bóng

Visibility – giá trị chế độ hiển thị

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

guestsCanInviteOthers()

Xác định xem khách có thể mời những khách khác hay không.

// 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');
}

Cầu thủ trả bóng

Booleantrue nếu khách có thể mời người khác; false nếu không

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

guestsCanModify()

Xác định xem khách có thể chỉnh sửa sự kiện hay không.

// 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');
}

Cầu thủ trả bóng

Booleantrue nếu khách có thể chỉnh sửa sự kiện; false nếu không thể

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

guestsCanSeeGuests()

Xác định xem khách có thể nhìn thấy khách khác hay không.

// 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');
}

Cầu thủ trả bóng

Booleantrue nếu khách có thể thấy các khách khác; false nếu không thể

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

isOwnedByMe()

Xác định xem bạn có phải là chủ sở hữu sự kiện hay không.

// 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');
}

Cầu thủ trả bóng

Booleantrue nếu sự kiện thuộc sở hữu của người dùng có hiệu lực; false nếu không phải

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

removeAllReminders()

Xoá tất cả lời nhắc khỏi sự kiện.

// 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');
}

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

removeGuest(email)

Xoá khách khỏi sự kiện.

// 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);
  }
}

Các tham số

TênLoạiNội dung mô tả
emailStringđịa chỉ email của khách

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

resetRemindersToDefault()

Đặt lại lời nhắc bằng chế độ cài đặt mặc định của lịch.

// 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');
}

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setAnyoneCanAddSelf(anyoneCanAddSelf)

Thiết lập liệu những khách không phải khách có thể tự thêm chính mình vào sự kiện hay không.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
anyoneCanAddSelfBooleanliệu mọi người có thể mời chính mình hay không

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setColor(color)

Đặt màu cho sự kiện trên lịch.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
colorStringChỉ mục màu số nguyên dưới dạng chuỗi hoặc giá trị từ CalendarApp.EventColor.

Cầu thủ trả bóng

CalendarEventSeries — Sự kiện trên lịch này, để tạo chuỗi.

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setDescription(description)

Đặt nội dung mô tả sự kiện.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
descriptionStringnội dung mô tả mới

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setGuestsCanInviteOthers(guestsCanInviteOthers)

Đặt xem khách có thể mời những khách khác hay không.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
guestsCanInviteOthersBooleanliệu khách có thể mời người khác hay không

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setGuestsCanModify(guestsCanModify)

Đặt xem khách có thể sửa đổi sự kiện hay không.

Các tham số

TênLoạiNội dung mô tả
guestsCanModifyBooleankhách có thể sửa đổi sự kiện hay không

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setGuestsCanSeeGuests(guestsCanSeeGuests)

Thiết lập liệu khách có thể nhìn thấy những khách khác hay không.

Các tham số

TênLoạiNội dung mô tả
guestsCanSeeGuestsBooleankhách có thể thấy những người khác hay không

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setLocation(location)

Thiết lập vị trí của sự kiện.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
locationStringvị trí mới

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setMyStatus(status)

Đặt trạng thái sự kiện (chẳng hạn như đang tham dự hoặc được mời) của người dùng có hiệu lực.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
statusGuestStatustrạng thái mới

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setRecurrence(recurrence, startDate)

Đặt quy tắc lặp lại cho một chuỗi sự kiện cả ngày. Việc áp dụng phương thức này sẽ thay đổi một chuỗi sự kiện thông thường thành một chuỗi sự kiện cả ngày.

// Sets the events in a series to take place every Wednesday in 2013.
var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com');
var startDate = new Date('January 2, 2013 03:00:00 PM EST');
var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
    .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
    .until(new Date('January 1, 2014'));
eventSeries.setRecurrence(recurrence, startDate);

Các tham số

TênLoạiNội dung mô tả
recurrenceEventRecurrencecác quy tắc lặp lại để sử dụng
startDateDatengày diễn ra sự kiện đầu tiên trong chuỗi (chỉ sử dụng ngày; bỏ qua thời gian)

Cầu thủ trả bóng

CalendarEventSeries — CalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setRecurrence(recurrence, startTime, endTime)

Đặt quy tắc lặp lại cho chuỗi sự kiện này. Việc áp dụng phương thức này sẽ thay đổi một chuỗi sự kiện cả ngày thành một chuỗi sự kiện thông thường.

// Sets the events in a series to take place from 3pm to 4pm every Tuesday and Thursday in
// 2013.
var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com');
var startTime = new Date('January 1, 2013 03:00:00 PM EST');
var endTime = new Date('January 1, 2013 04:00:00 PM EST');
var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
     .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
     .until(new Date('January 1, 2014'));
eventSeries.setRecurrence(recurrence, startTime, endTime);

Các tham số

TênLoạiNội dung mô tả
recurrenceEventRecurrencecác quy tắc lặp lại để sử dụng
startTimeDatengày và giờ khi sự kiện đầu tiên trong chuỗi bắt đầu
endTimeDatengày và giờ khi sự kiện đầu tiên trong chuỗi kết thúc

Cầu thủ trả bóng

CalendarEventSeries — CalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setTag(key, value)

Đặt thẻ khoá/giá trị cho sự kiện để lưu trữ siêu dữ liệu tuỳ chỉnh.

Các tham số

TênLoạiNội dung mô tả
keyStringkhoá thẻ
valueStringgiá trị thẻ

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setTitle(title)

Đặt tiêu đề của sự kiện.

// 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');
}

Các tham số

TênLoạiNội dung mô tả
titleStringtiêu đề mới

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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

setVisibility(visibility)

Thiết lập chế độ hiển thị của sự kiện.

Các tham số

TênLoạiNội dung mô tả
visibilityVisibility

Cầu thủ trả bóng

CalendarEventSeriesCalendarEventSeries này để tạo chuỗi

Ủy quyền

Các tập lệnh sử dụng phương thức này cần được uỷ quyền với một hoặc nhiều phạm vi hoặc phạm vi thích hợp sau đây từ API REST có liên quan:

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