Biểu thị một chuỗi sự kiện (sự kiện định kỳ).
Phương thức
| Phương thức | Kiểu dữ liệu trả về | Mô tả ngắn |
|---|---|---|
add | Calendar | Thêm một lời nhắc mới qua email vào sự kiện. |
add | Calendar | Thêm khách vào sự kiện. |
add | Calendar | Thêm một thông báo bật lên mới vào sự kiện. |
add | Calendar | Thêm một lời nhắc mới qua SMS vào sự kiện. |
anyone | Boolean | 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. |
delete | void | Xoá chuỗi sự kiện. |
delete | Calendar | Xoá thẻ khoá/giá trị khỏi sự kiện. |
get | String[] | Lấy tất cả các khoá cho những thẻ đã được đặt trên sự kiện. |
get | String | Trả về màu của sự kiện trên lịch. |
get | String[] | Lấy người tạo sự kiện. |
get | Date | Lấy ngày tạo sự kiện. |
get | String | Lấy nội dung mô tả của sự kiện. |
get | Integer[] | Lấy giá trị phút cho tất cả thông báo nhắc nhở qua email cho sự kiện. |
get | Event | Lấy Event của sự kiện này. |
get | Event | Lấy khách theo địa chỉ email. |
get | Event | Lấy khách mời của sự kiện, không bao gồm chủ sở hữu sự kiện. |
get | Event | Lấy khách cho sự kiện, có thể bao gồm cả chủ sở hữu sự kiện. |
get | String | Lấy iCalUID duy nhất của sự kiện. |
get | Date | Lấy ngày gần đây nhất sự kiện được cập nhật. |
get | String | Lấy vị trí của sự kiện. |
get | Guest | Lấy 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. |
get | String | Lấy mã nhận dạng của lịch nơi sự kiện này được tạo ban đầu. |
get | Integer[] | Lấy giá trị phút cho tất cả lời nhắc dưới dạng cửa sổ bật lên của sự kiện. |
get | Integer[] | Lấy giá trị phút cho tất cả lời nhắc qua SMS của sự kiện. |
get | String | Lấy giá trị thẻ của sự kiện. |
get | String | Lấy tiêu đề của sự kiện. |
get | Event | Lấy độ trong suốt của sự kiện. |
get | Visibility | Lấy chế độ hiển thị của sự kiện. |
guests | Boolean | Xác định xem khách có thể mời khách khác hay không. |
guests | Boolean | Xác định xem khách có thể sửa đổi sự kiện hay không. |
guests | Boolean | Xác định xem khách có thể nhìn thấy những khách khác hay không. |
is | Boolean | Xác định xem bạn có phải là chủ sở hữu của sự kiện hay không. |
remove | Calendar | Xoá tất cả lời nhắc khỏi sự kiện. |
remove | Calendar | Xoá một khách khỏi sự kiện. |
reset | Calendar | Đặt lại lời nhắc bằng chế độ cài đặt mặc định của lịch. |
set | Calendar | Đặt xem những người không phải là khách có thể tự thêm mình vào sự kiện hay không. |
set | Calendar | Đặt màu cho sự kiện trên lịch. |
set | Calendar | Đặt nội dung mô tả cho sự kiện. |
set | Calendar | Đặt xem khách có thể mời khách khác hay không. |
set | Calendar | Đặt xem khách có thể sửa đổi sự kiện hay không. |
set | Calendar | Đặt liệu khách có thể thấy những khách khác hay không. |
set | Calendar | Đặt vị trí của sự kiện. |
set | Calendar | Đặ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. |
set | Calendar | Đặt quy tắc định kỳ cho một chuỗi sự kiện kéo dài cả ngày. |
set | Calendar | Đặt quy tắc lặp lại cho chuỗi sự kiện này. |
set | Calendar | Đặt thẻ khoá/giá trị cho sự kiện để lưu trữ siêu dữ liệu tuỳ chỉnh. |
set | Calendar | Đặt tiêu đề cho sự kiện. |
set | Calendar | Đặt độ trong suốt của sự kiện. |
set | Calendar | Đặt chế độ hiển thị của sự kiện. |
Tài liệu chi tiết
addEmailReminder(minutesBefore)
Thêm một lời nhắc mới qua email vào sự kiện. Lời nhắc phải được đặt ít nhất 5 phút và tối đa 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);
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
minutes | Integer | số phút trước khi diễn ra sự kiện |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu chuỗi
Gửi
Error – nếu có hơn 5 lời nhắc cho sự kiện hoặc thời gian không nằm trong phạm vi hợ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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 const attendeeEmail = 'user@example.com'; // Email address of the person you need to add const calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar containing // event const eventId = '123abc'; // ID of event instance const calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } const 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 const attendeeEmail = 'user@example.com'; // Email address of the person you need to add const calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar with the // events const startDate = new Date('YYYY-MM-DD'); // The first date to add the guest to the events const endDate = new Date('YYYY-MM-DD'); // The last date to add the guest to the events const calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } // Get the events within the specified timeframe const 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 (let i = 0; i < calEvents.length; i++) { const event = calEvents[i]; event.addGuest(attendeeEmail); } }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
email | String | Địa chỉ email của khách. |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này dùng để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
addPopupReminder(minutesBefore)
Thêm một thông báo bật lên mới vào sự kiện. Thông báo phải được gửi ít nhất 5 phút và tối đa 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 a pop-up notification for 15 minutes before the event. event.addPopupReminder(15);
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
minutes | Integer | số phút trước khi diễn ra sự kiện |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
addSmsReminder(minutesBefore)
Thêm một lời nhắc mới qua SMS vào sự kiện. Lời nhắc phải được đặt ít nhất 5 phút và tối đa 4 tuần (40320 phút) trước sự kiện.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
minutes | Integer | số phút trước khi diễn ra sự kiện |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu chuỗi
Gửi
Error – nếu có hơn 5 lời nhắc cho sự kiện hoặc thời gian không nằm trong phạm vi hợ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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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
Boolean – true nếu người không phải khách có thể tự thêm mình vào sự kiện; 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
key | String | khoá thẻ |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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ả các khoá cho những thẻ đã được đặt trên sự kiện.
Cầu thủ trả bóng
String[] – một mảng 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 biểu thị màu của sự kiện, dưới dạng chỉ mục (1-11) của các giá trị trong 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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()
Lấy 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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ả của 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 – nội dung 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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ả thông báo nhắc nhở qua email cho 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à 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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
getEventType()
Lấy EventType của sự kiện này.
// Opens the default calendar and logs all out-of-office events for the current day. const calendar = CalendarApp.getDefaultCalendar(); const events = calendar.getEventsForDay(new Date()); console.log(events.filter(e => e.getEventType() === CalendarApp.EventType.OUT_OF_OFFICE));
Cầu thủ trả bóng
EventType – Loạ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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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)
Lấy khách theo đị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()); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
email | String | địa chỉ của khách |
Cầu thủ trả bóng
EventGuest – khách hoặc giá trị rỗ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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
getGuestList()
Lấy khách mời của 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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)
Lấy khách cho 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()); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
include | Boolean | có nên thê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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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à id sự kiện mà API Lịch phiên bản 3 và dị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 diễn ra của một sự kiện đều có ids khác nhau trong khi tất cả đều dùng chung 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 gần đây nhất sự kiện được cập 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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()
Lấy 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 có hiệu lực 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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ã nhận dạng của 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ã nhận dạng của lịch ban đầ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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 dưới dạng cửa sổ bật lên 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 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à 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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()
Lấy giá trị phút cho tất cả lời nhắc qua SMS của 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à 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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)
Lấy giá trị thẻ của sự kiện.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
key | String | khoá |
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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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@example.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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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
getTransparency()
Lấy độ trong suốt của sự kiện. Sử dụng phương thức này để xác định xem một sự kiện là
TRANSPARENT (tức là lịch hiển thị là Rảnh trong khoảng thời gian đó) hay OPAQUE
(tức là lịch hiển thị là Bận trong khoảng thời gian đó).
// Gets the first event from the default calendar for today. const today = new Date(); const event = CalendarApp.getDefaultCalendar().getEventsForDay(today)[0]; // Gets the event's transparency and logs it. const transparency = event.getTransparency(); Logger.log(transparency);
Cầu thủ trả bóng
EventTransparency – Giá trị minh bạ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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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()
Lấy 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ị về khả năng 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 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
Boolean – true 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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ể sửa đổi 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
Boolean – true nếu khách có thể sửa đổi sự kiện; 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 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 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
Boolean – true nếu khách có thể xem những khách 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 của 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
Boolean – true nếu sự kiện thuộc sở hữu của người dùng hiệu quả; 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
removeGuest(email)
Xoá một khách khỏi sự kiện.
// Example 1: Remove a guest from one event function removeGuestFromEvent() { // Replace the below values with your own const attendeeEmail = 'user@example.com'; // Email address of the person you need to remove const calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar containing // event const eventId = '123abc'; // ID of event instance const calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } const 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 const attendeeEmail = 'user@example.com'; // Email address of the person you need to remove const calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar with the // events const startDate = new Date( 'YYYY-MM-DD'); // The first date to remove the guest from the events const endDate = new Date( 'YYYY-MM-DD'); // The last date to remove the attendee from the events const calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } // Get the events within the specified timeframe const 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 (let i = 0; i < calEvents.length; i++) { const event = calEvents[i]; event.removeGuest(attendeeEmail); } }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
email | String | địa chỉ email của khách |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setAnyoneCanAddSelf(anyoneCanAddSelf)
Đặt xem những người không phải là khách có thể tự thêm 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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
anyone | Boolean | liệu có ai có thể tự mời mình hay không |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
color | String | Chỉ mục màu nguyên dưới dạng chuỗi hoặc giá trị từ Calendar. |
Cầu thủ trả bóng
CalendarEventSeries – Sự kiện trên lịch này, dùng để liên kế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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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ả cho 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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
description | String | nội dung mô tả mới |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
guests | Boolean | khách có thể mời người khác hay không |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
guests | Boolean | khách có thể sửa đổi sự kiện hay không |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setGuestsCanSeeGuests(guestsCanSeeGuests)
Đặt liệu khách có thể thấy những khách khác hay không.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
guests | Boolean | liệu khách có thể nhìn thấy những người khác |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setLocation(location)
Đặt 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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
location | String | vị trí mới |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
status | Guest | trạng thái mới |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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 định kỳ cho một chuỗi sự kiện kéo dài 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. const eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById( '123456789@example.com', ); const startDate = new Date('January 2, 2013 03:00:00 PM EST'); const recurrence = CalendarApp.newRecurrence() .addWeeklyRule() .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY) .until(new Date('January 1, 2014')); eventSeries.setRecurrence(recurrence, startDate);
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
recurrence | Event | các quy tắc lặp lại cần sử dụng |
start | Date | ngày diễn ra sự kiện đầu tiên trong chuỗi sự kiện (chỉ sử dụng ngày; thời gian sẽ bị bỏ qua) |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để liên kế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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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. const eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById( '123456789@example.com', ); const startTime = new Date('January 1, 2013 03:00:00 PM EST'); const endTime = new Date('January 1, 2013 04:00:00 PM EST'); const recurrence = CalendarApp.newRecurrence() .addWeeklyRule() .onlyOnWeekdays( [CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY]) .until(new Date('January 1, 2014')); eventSeries.setRecurrence(recurrence, startTime, endTime);
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
recurrence | Event | các quy tắc lặp lại cần sử dụng |
start | Date | ngày và giờ bắt đầu sự kiện đầu tiên trong chuỗi |
end | Date | ngày và giờ kết thúc sự kiện đầu tiên trong chuỗi |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để liên kế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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp 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.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
key | String | khoá thẻ |
value | String | giá trị thẻ |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setTitle(title)
Đặt tiêu đề cho 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@example.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'); }
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
title | String | tiêu đề mới |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setTransparency(transparency)
Đặt độ trong suốt của sự kiện. Sử dụng phương thức này để đặt xem một sự kiện là
TRANSPARENT (tức là lịch hiển thị là Rảnh trong khoảng thời gian đó) hay OPAQUE
(tức là lịch hiển thị là Bận trong khoảng thời gian đó).
// 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'); // Sets the event's transparency to TRANSPARENT. event.setTransparency(CalendarApp.EventTransparency.TRANSPARENT);
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
transparency | Event | Giá trị minh bạch. |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này dùng để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setVisibility(visibility)
Đặt chế độ hiển thị của sự kiện.
Tham số
| Tên | Loại | Mô tả |
|---|---|---|
visibility | Visibility |
Cầu thủ trả bóng
CalendarEventSeries – CalendarEventSeries này để xâu 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 bằng một hoặc nhiều phạm vi sau đây hoặc các phạm vi thích hợp từ API REST có liên quan:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds