Class CalendarEventSeries

CalendarEventSeries

แสดงชุดของกิจกรรม (กิจกรรมที่เกิดซ้ำ)

วิธีการ

วิธีการประเภทการแสดงผลรายละเอียดแบบย่อ
addEmailReminder(minutesBefore)CalendarEventSeriesเพิ่มอีเมลแจ้งเตือนใหม่ไปยังกิจกรรม
addGuest(email)CalendarEventSeriesเพิ่มผู้เข้าร่วมในกิจกรรม
addPopupReminder(minutesBefore)CalendarEventSeriesเพิ่มการแจ้งเตือนแบบป๊อปอัปใหม่ในกิจกรรม
addSmsReminder(minutesBefore)CalendarEventSeriesเพิ่มการแจ้งเตือนทาง SMS ใหม่ไปยังกิจกรรม
anyoneCanAddSelf()Booleanกำหนดว่าผู้อื่นจะเพิ่มตนเองเป็นผู้เข้าร่วมกิจกรรมในปฏิทินได้หรือไม่
deleteEventSeries()voidลบชุดกิจกรรม
deleteTag(key)CalendarEventSeriesลบแท็กคีย์/ค่าออกจากเหตุการณ์
getAllTagKeys()String[]รับคีย์ทั้งหมดสำหรับแท็กที่ตั้งค่าไว้ในเหตุการณ์
getColor()Stringแสดงสีของกิจกรรมในปฏิทิน
getCreators()String[]รับผู้สร้างกิจกรรม
getDateCreated()Dateรับข้อมูลวันที่สร้างกิจกรรม
getDescription()Stringรับคำอธิบายกิจกรรม
getEmailReminders()Integer[]รับค่านาทีสำหรับการช่วยเตือนทางอีเมลทั้งหมดของกิจกรรมนั้น
getGuestByEmail(email)EventGuestรับแขกทางอีเมล
getGuestList()EventGuest[]รับผู้เข้าร่วมกิจกรรม โดยไม่รวมเจ้าของกิจกรรม
getGuestList(includeOwner)EventGuest[]รับผู้เข้าร่วมกิจกรรม ซึ่งอาจรวมถึงเจ้าของกิจกรรม
getId()Stringรับ iCalUID ที่ไม่ซ้ำกันของกิจกรรม
getLastUpdated()Dateรับข้อมูลวันที่อัปเดตกิจกรรมครั้งล่าสุด
getLocation()Stringรับข้อมูลตำแหน่งของกิจกรรม
getMyStatus()GuestStatusรับสถานะกิจกรรม (เช่น เข้าร่วมหรือได้รับเชิญ) ของผู้ใช้ที่มีประสิทธิภาพ
getOriginalCalendarId()Stringรับรหัสของปฏิทินที่สร้างกิจกรรมนี้ขึ้นในตอนแรก
getPopupReminders()Integer[]รับค่านาทีสำหรับการช่วยเตือนแบบป๊อปอัปทั้งหมดสำหรับกิจกรรม
getSmsReminders()Integer[]รับค่านาทีสำหรับการแจ้งเตือนทาง SMS ทั้งหมดของกิจกรรม
getTag(key)Stringรับค่าแท็กของเหตุการณ์
getTitle()Stringรับชื่อกิจกรรม
getVisibility()Visibilityรับข้อมูลระดับการเข้าถึงกิจกรรม
guestsCanInviteOthers()Booleanกำหนดว่าผู้เข้าร่วมสามารถเชิญผู้เข้าร่วมคนอื่นได้หรือไม่
guestsCanModify()Booleanกำหนดว่าผู้เข้าร่วมจะแก้ไขกิจกรรมได้หรือไม่
guestsCanSeeGuests()Booleanกำหนดว่าผู้เข้าร่วมจะเห็นผู้เข้าร่วมคนอื่นๆ ได้หรือไม่
isOwnedByMe()Booleanกำหนดว่าคุณเป็นเจ้าของกิจกรรมหรือไม่
removeAllReminders()CalendarEventSeriesนำการช่วยเตือนทั้งหมดออกจากกิจกรรม
removeGuest(email)CalendarEventSeriesนำผู้เข้าร่วมออกจากกิจกรรม
resetRemindersToDefault()CalendarEventSeriesรีเซ็ตการแจ้งเตือนโดยใช้การตั้งค่าเริ่มต้นของปฏิทิน
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEventSeriesตั้งค่าว่าผู้ที่ไม่ใช่ผู้เข้าร่วมสามารถเพิ่มตนเองในกิจกรรมได้หรือไม่
setColor(color)CalendarEventSeriesตั้งค่าสีของกิจกรรมในปฏิทิน
setDescription(description)CalendarEventSeriesตั้งค่าคำอธิบายกิจกรรม
setGuestsCanInviteOthers(guestsCanInviteOthers)CalendarEventSeriesตั้งค่าว่าผู้เข้าร่วมสามารถเชิญผู้เข้าร่วมคนอื่นๆ ได้หรือไม่
setGuestsCanModify(guestsCanModify)CalendarEventSeriesตั้งค่าว่าผู้เข้าร่วมจะแก้ไขกิจกรรมได้หรือไม่
setGuestsCanSeeGuests(guestsCanSeeGuests)CalendarEventSeriesตั้งค่าว่าผู้เข้าร่วมจะเห็นผู้เข้าร่วมคนอื่นๆ หรือไม่
setLocation(location)CalendarEventSeriesตั้งค่าสถานที่ของกิจกรรม
setMyStatus(status)CalendarEventSeriesตั้งค่าสถานะกิจกรรม (เช่น เข้าร่วมหรือได้รับเชิญ) ของผู้ใช้ที่มีประสิทธิภาพ
setRecurrence(recurrence, startDate)CalendarEventSeriesตั้งค่ากฎการเกิดซ้ำสำหรับชุดกิจกรรมตลอดทั้งวัน
setRecurrence(recurrence, startTime, endTime)CalendarEventSeriesตั้งค่ากฎการเกิดซ้ำสำหรับชุดกิจกรรมนี้
setTag(key, value)CalendarEventSeriesตั้งค่าแท็กคีย์/ค่าในเหตุการณ์สำหรับจัดเก็บข้อมูลเมตาที่กำหนดเอง
setTitle(title)CalendarEventSeriesตั้งชื่อกิจกรรม
setVisibility(visibility)CalendarEventSeriesตั้งค่าระดับการเข้าถึงกิจกรรม

เอกสารประกอบโดยละเอียด

addEmailReminder(minutesBefore)

เพิ่มอีเมลแจ้งเตือนใหม่ไปยังกิจกรรม โดยจะต้องเป็นเวลาอย่างน้อย 5 นาที และไม่เกิน 4 สัปดาห์ (40,320 นาที) ก่อนเริ่มกิจกรรม

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
minutesBeforeIntegerจำนวนนาทีก่อนกิจกรรมเริ่ม

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การขว้าง

Error — หากมีการช่วยเตือนมากกว่า 5 รายการในกิจกรรมหรือเวลาไม่อยู่ในช่วงของกฎหมาย

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

addGuest(email)

เพิ่มผู้เข้าร่วมในกิจกรรม

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

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
emailStringอีเมลของผู้เข้าร่วม

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

addPopupReminder(minutesBefore)

เพิ่มการแจ้งเตือนแบบป๊อปอัปใหม่ในกิจกรรม โดยจะต้องเป็นเวลาอย่างน้อย 5 นาทีและไม่เกิน 4 สัปดาห์ (40,320 นาที) ก่อนกิจกรรมจะเริ่ม

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
minutesBeforeIntegerจำนวนนาทีก่อนกิจกรรมเริ่ม

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

addSmsReminder(minutesBefore)

เพิ่มการแจ้งเตือนทาง SMS ใหม่ไปยังกิจกรรม โดยจะต้องเป็นเวลาอย่างน้อย 5 นาที และไม่เกิน 4 สัปดาห์ (40,320 นาที) ก่อนเริ่มกิจกรรม

พารามิเตอร์

ชื่อTypeคำอธิบาย
minutesBeforeIntegerจำนวนนาทีก่อนกิจกรรมเริ่ม

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การขว้าง

Error — หากมีการช่วยเตือนมากกว่า 5 รายการในกิจกรรมหรือเวลาไม่อยู่ในช่วงของกฎหมาย

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

anyoneCanAddSelf()

กำหนดว่าผู้อื่นจะเพิ่มตนเองเป็นผู้เข้าร่วมกิจกรรมในปฏิทินได้หรือไม่

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

รีเทิร์น

Booleantrue หากผู้ที่ไม่ใช่ผู้เข้าร่วมสามารถเพิ่มตนเองในกิจกรรมได้ false หากไม่ใช่ผู้เข้าร่วม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

deleteEventSeries()

ลบชุดกิจกรรม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

deleteTag(key)

ลบแท็กคีย์/ค่าออกจากเหตุการณ์

พารามิเตอร์

ชื่อTypeคำอธิบาย
keyStringคีย์แท็ก

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getAllTagKeys()

รับคีย์ทั้งหมดสำหรับแท็กที่ตั้งค่าไว้ในเหตุการณ์

รีเทิร์น

String[] — อาร์เรย์ของคีย์สตริง

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getColor()

แสดงสีของกิจกรรมในปฏิทิน

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

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

รีเทิร์น

String — การแสดงสตริงของสีเหตุการณ์ในรูปแบบดัชนี (1-11) ของค่าจาก CalendarApp.EventColor

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getCreators()

รับผู้สร้างกิจกรรม

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

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

รีเทิร์น

String[] — อีเมลของผู้สร้างกิจกรรม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getDateCreated()

รับข้อมูลวันที่สร้างกิจกรรม คุณต้องมีสิทธิ์เข้าถึงปฏิทิน

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

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

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

รีเทิร์น

Date — วันที่สร้าง

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getDescription()

รับคำอธิบายกิจกรรม คุณต้องมีสิทธิ์แก้ไขปฏิทิน

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

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

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

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

รีเทิร์น

String — คำอธิบาย

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getEmailReminders()

รับค่านาทีสำหรับการช่วยเตือนทางอีเมลทั้งหมดของกิจกรรมนั้น คุณต้องมีสิทธิ์แก้ไขปฏิทิน

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

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

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

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

รีเทิร์น

Integer[] — อาร์เรย์ที่แต่ละค่าสอดคล้องกับจำนวนนาทีก่อนเหตุการณ์ที่ทริกเกอร์การช่วยเตือน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getGuestByEmail(email)

รับแขกทางอีเมล

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

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
emailStringที่อยู่ของแขก

รีเทิร์น

EventGuest — ผู้เข้าร่วม หรือ Null หากที่อยู่อีเมลไม่ตรงกับผู้เข้าร่วม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getGuestList()

รับผู้เข้าร่วมกิจกรรม โดยไม่รวมเจ้าของกิจกรรม

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

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

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

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

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

รีเทิร์น

EventGuest[] — อาร์เรย์ของผู้เข้าร่วม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getGuestList(includeOwner)

รับผู้เข้าร่วมกิจกรรม ซึ่งอาจรวมถึงเจ้าของกิจกรรม

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

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
includeOwnerBooleanจะรวมเจ้าของเป็นแขกไหม

รีเทิร์น

EventGuest[] — อาร์เรย์ของผู้เข้าร่วม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getId()

รับ iCalUID ที่ไม่ซ้ำกันของกิจกรรม โปรดทราบว่า iCalUID และกิจกรรม id ที่ใช้โดย Calendar v3 API และบริการขั้นสูงของปฏิทินจะเหมือนกันและจะใช้แทนกันไม่ได้ ความแตกต่างอย่างหนึ่งในความหมายคือ ในเหตุการณ์ที่เกิดซ้ำทุกรายการของ 1 เหตุการณ์จะมี ids ต่างกัน ในขณะที่ทุกเหตุการณ์ใช้ iCalUID เดียวกัน

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

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

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

รีเทิร์น

String — iCalUID ของเหตุการณ์

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getLastUpdated()

รับข้อมูลวันที่อัปเดตกิจกรรมครั้งล่าสุด

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

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

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

รีเทิร์น

Date — วันที่อัปเดตล่าสุด

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getLocation()

รับข้อมูลตำแหน่งของกิจกรรม

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

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

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

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

รีเทิร์น

String — สถานที่จัดกิจกรรม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getMyStatus()

รับสถานะกิจกรรม (เช่น เข้าร่วมหรือได้รับเชิญ) ของผู้ใช้ที่มีประสิทธิภาพ แสดงผล GuestStatus.OWNER เสมอหากผู้ใช้ที่มีประสิทธิภาพเป็นเจ้าของกิจกรรม

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

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

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

รีเทิร์น

GuestStatus — สถานะ

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getOriginalCalendarId()

รับรหัสของปฏิทินที่สร้างกิจกรรมนี้ขึ้นในตอนแรก

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

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

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

รีเทิร์น

String — รหัสของปฏิทินดั้งเดิม

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getPopupReminders()

รับค่านาทีสำหรับการช่วยเตือนแบบป๊อปอัปทั้งหมดสำหรับกิจกรรม

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

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

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

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

รีเทิร์น

Integer[] — อาร์เรย์ที่แต่ละค่าสอดคล้องกับจำนวนนาทีก่อนเหตุการณ์ที่ทริกเกอร์การช่วยเตือน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getSmsReminders()

รับค่านาทีสำหรับการแจ้งเตือนทาง SMS ทั้งหมดของกิจกรรม

รีเทิร์น

Integer[] — อาร์เรย์ที่แต่ละค่าสอดคล้องกับจำนวนนาทีก่อนเหตุการณ์ที่ทริกเกอร์การช่วยเตือน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getTag(key)

รับค่าแท็กของเหตุการณ์

พารามิเตอร์

ชื่อTypeคำอธิบาย
keyStringคีย์

รีเทิร์น

String — ค่าแท็ก

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getTitle()

รับชื่อกิจกรรม

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

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

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

รีเทิร์น

String — ชื่อ

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

getVisibility()

รับข้อมูลระดับการเข้าถึงกิจกรรม

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

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

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

รีเทิร์น

Visibility — ค่าการแสดงผล

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

guestsCanInviteOthers()

กำหนดว่าผู้เข้าร่วมสามารถเชิญผู้เข้าร่วมคนอื่นได้หรือไม่

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

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

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

รีเทิร์น

Booleantrue หากผู้เข้าร่วมสามารถเชิญผู้อื่นได้ false หากไม่สามารถทำได้

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

guestsCanModify()

กำหนดว่าผู้เข้าร่วมจะแก้ไขกิจกรรมได้หรือไม่

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

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

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

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

รีเทิร์น

Booleantrue หากผู้เข้าร่วมแก้ไขกิจกรรมได้ false หากไม่แก้ไข

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

guestsCanSeeGuests()

กำหนดว่าผู้เข้าร่วมจะเห็นผู้เข้าร่วมคนอื่นๆ ได้หรือไม่

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

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

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

รีเทิร์น

Booleantrue หากผู้เข้าร่วมเห็นผู้เข้าร่วมคนอื่นๆ ได้ false หากไม่มองเห็น

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

isOwnedByMe()

กำหนดว่าคุณเป็นเจ้าของกิจกรรมหรือไม่

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

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

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

รีเทิร์น

Booleantrue หากกิจกรรมเป็นของผู้ใช้ที่มีผล false หากไม่ใช่

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

removeAllReminders()

นำการช่วยเตือนทั้งหมดออกจากกิจกรรม

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

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

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

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

removeGuest(email)

นำผู้เข้าร่วมออกจากกิจกรรม

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

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
emailStringอีเมลของผู้เข้าร่วม

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

resetRemindersToDefault()

รีเซ็ตการแจ้งเตือนโดยใช้การตั้งค่าเริ่มต้นของปฏิทิน

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

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

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

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setAnyoneCanAddSelf(anyoneCanAddSelf)

ตั้งค่าว่าผู้ที่ไม่ใช่ผู้เข้าร่วมสามารถเพิ่มตนเองในกิจกรรมได้หรือไม่

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
anyoneCanAddSelfBooleanว่าจะให้ใครเชิญตัวเองได้บ้าง

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setColor(color)

ตั้งค่าสีของกิจกรรมในปฏิทิน

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
colorStringดัชนีสีแบบจำนวนเต็มที่เป็นสตริง หรือค่าจาก CalendarApp.EventColor

รีเทิร์น

CalendarEventSeries — กิจกรรมในปฏิทินนี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setDescription(description)

ตั้งค่าคำอธิบายกิจกรรม

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
descriptionStringคำอธิบายใหม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setGuestsCanInviteOthers(guestsCanInviteOthers)

ตั้งค่าว่าผู้เข้าร่วมสามารถเชิญผู้เข้าร่วมคนอื่นๆ ได้หรือไม่

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
guestsCanInviteOthersBooleanผู้เข้าร่วมสามารถเชิญผู้อื่นได้หรือไม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setGuestsCanModify(guestsCanModify)

ตั้งค่าว่าผู้เข้าร่วมจะแก้ไขกิจกรรมได้หรือไม่

พารามิเตอร์

ชื่อTypeคำอธิบาย
guestsCanModifyBooleanผู้เข้าร่วมสามารถแก้ไขกิจกรรมได้หรือไม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setGuestsCanSeeGuests(guestsCanSeeGuests)

ตั้งค่าว่าผู้เข้าร่วมจะเห็นผู้เข้าร่วมคนอื่นๆ หรือไม่

พารามิเตอร์

ชื่อTypeคำอธิบาย
guestsCanSeeGuestsBooleanผู้เข้าร่วมจะเห็นบุคคลอื่นหรือไม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setLocation(location)

ตั้งค่าสถานที่ของกิจกรรม

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
locationStringตำแหน่งใหม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setMyStatus(status)

ตั้งค่าสถานะกิจกรรม (เช่น เข้าร่วมหรือได้รับเชิญ) ของผู้ใช้ที่มีประสิทธิภาพ

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
statusGuestStatusสถานะใหม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setRecurrence(recurrence, startDate)

ตั้งค่ากฎการเกิดซ้ำสำหรับชุดกิจกรรมตลอดทั้งวัน การใช้วิธีนี้จะเปลี่ยนชุดกิจกรรมปกติ เป็นชุดกิจกรรมแบบตลอดวัน

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
recurrenceEventRecurrenceกฎการเกิดซ้ำที่จะใช้
startDateDateวันที่ของกิจกรรมแรกของชุดนี้ (ใช้เฉพาะวัน โดยระบบจะไม่สนใจเวลา)

รีเทิร์น

CalendarEventSeries — CalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setRecurrence(recurrence, startTime, endTime)

ตั้งค่ากฎการเกิดซ้ำสำหรับชุดกิจกรรมนี้ การใช้วิธีนี้จะเปลี่ยนซีรีส์กิจกรรมตลอดทั้งวันเป็นชุดกิจกรรมปกติ

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
recurrenceEventRecurrenceกฎการเกิดซ้ำที่จะใช้
startTimeDateวันที่และเวลาที่กิจกรรมแรกในชุดเริ่มต้น
endTimeDateวันที่และเวลาที่กิจกรรมแรกของชุดกิจกรรมสิ้นสุดลง

รีเทิร์น

CalendarEventSeries — CalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setTag(key, value)

ตั้งค่าแท็กคีย์/ค่าในเหตุการณ์สำหรับจัดเก็บข้อมูลเมตาที่กำหนดเอง

พารามิเตอร์

ชื่อTypeคำอธิบาย
keyStringคีย์แท็ก
valueStringค่าแท็ก

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setTitle(title)

ตั้งชื่อกิจกรรม

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

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

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

พารามิเตอร์

ชื่อTypeคำอธิบาย
titleStringชื่อใหม่

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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

setVisibility(visibility)

ตั้งค่าระดับการเข้าถึงกิจกรรม

พารามิเตอร์

ชื่อTypeคำอธิบาย
visibilityVisibility

รีเทิร์น

CalendarEventSeriesCalendarEventSeries นี้สำหรับการทำเชน

การให้สิทธิ์

สคริปต์ที่ใช้วิธีนี้จะต้องมีการให้สิทธิ์กับขอบเขตต่อไปนี้อย่างน้อย 1 รายการ หรือขอบเขตที่เหมาะสมจาก REST API ที่เกี่ยวข้อง

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