Class CalendarEventSeries

CalendarEventSeries

מייצג סדרה של אירועים (אירוע חוזר).

Methods

שיטהסוג הערך שמוחזרתיאור קצר
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[]מחזירה את ערכי הדקות של כל התזכורות באימייל לאירוע.
getEventType()EventTypeהפונקציה מחזירה את ה-EventType של האירוע הזה.
getGuestByEmail(email)EventGuestמקבל אורח לפי כתובת אימייל.
getGuestList()EventGuest[]מקבל את המשתתפים באירוע, לא כולל את הבעלים של האירוע.
getGuestList(includeOwner)EventGuest[]מקבל את המשתתפים באירוע, כולל בעלי האירוע.
getId()Stringמחזירה את המזהה הייחודי של האירוע ב-iCal.
getLastUpdated()Dateמחזירה את התאריך שבו האירוע עודכן לאחרונה.
getLocation()Stringהפונקציה מחזירה את המיקום של האירוע.
getMyStatus()GuestStatusמקבל את סטטוס האירוע (לדוגמה, משתתף או מוזמן) של המשתמש הרלוונטי.
getOriginalCalendarId()Stringקבלת המזהה של היומן שבו האירוע הזה נוצר במקור.
getPopupReminders()Integer[]מחזירה את ערכי הדקות של כל התזכורות הקופצות לאירוע.
getSmsReminders()Integer[]מקבל את ערכי הדקות של כל התזכורות באירוע באמצעות SMS.
getTag(key)Stringמחזירה את ערך התג של האירוע.
getTitle()Stringמחזירה את שם האירוע.
getTransparency()EventTransparencyמקבל את השקיפות של האירוע.
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הגדרת שם האירוע.
setTransparency(transparency)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);

פרמטרים

שםסוגתיאור
minutesBeforeIntegerמספר הדקות לפני האירוע

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

מקפיצה את הודעות השגיאה (Throws)

Error — אם יש יותר מ-5 תזכורות לאירוע או שהשעה לא נמצאת בטווח המותר

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

פרמטרים

שםסוגתיאור
emailStringכתובת האימייל של האורח.

חזרה

CalendarEventSeries — This CalendarEventSeries for chaining.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

addPopupReminder(minutesBefore)

הוספת תזכורת קופצת חדשה לאירוע. ההתראה צריכה להישלח לפחות 5 דקות לפני האירוע, ולכל היותר 4 שבועות לפני האירוע (40,320 דקות).

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

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

פרמטרים

שםסוגתיאור
minutesBeforeIntegerמספר הדקות לפני האירוע

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

addSmsReminder(minutesBefore)

הוספת תזכורת חדשה לאירוע באמצעות SMS. התזכורת צריכה להיות לפחות 5 דקות ולכל היותר 4 שבועות (40,320 דקות) לפני האירוע.

פרמטרים

שםסוגתיאור
minutesBeforeIntegerמספר הדקות לפני האירוע

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

מקפיצה את הודעות השגיאה (Throws)

Error — אם יש יותר מ-5 תזכורות לאירוע או שהשעה לא נמצאת בטווח המותר

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 אם לא

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

deleteEventSeries()

מוחק את סדרת האירועים.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

deleteTag(key)

מוחק תג מפתח/ערך מהאירוע.

פרמטרים

שםסוגתיאור
keyStringמפתח התג

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getAllTagKeys()

מחזירה את כל המפתחות של התגים שהוגדרו באירוע.

חזרה

String[] — מערך של מפתחות מחרוזת

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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[] – כתובות האימייל של יוצרי האירוע

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 – תאריך היצירה

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 — התיאור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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[] – מערך שבו כל ערך תואם למספר הדקות לפני האירוע שבהן מופעלת תזכורת

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getEventType()

הפונקציה מחזירה את ה-EventType של האירוע הזה.

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

חזרה

EventType – סוג האירוע.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getGuestByEmail(email)

מקבל אורח לפי כתובת אימייל.

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

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

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

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

פרמטרים

שםסוגתיאור
emailStringהכתובת של האורח

חזרה

EventGuest – האורח, או null אם כתובת האימייל לא שייכת לאורח

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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[] – מערך של האורחים

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getGuestList(includeOwner)

מקבל את המשתתפים באירוע, כולל בעלי האירוע.

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

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

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

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

פרמטרים

שםסוגתיאור
includeOwnerBooleanאם לכלול את הבעלים כאורחים

חזרה

EventGuest[] – מערך של האורחים

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getId()

מחזירה את המזהה הייחודי של האירוע ב-iCal. חשוב לשים לב שמזהה ה-iCalUID והאירוע id שבהם נעשה שימוש ב-Calendar v3 API וב-Calendar advanced service הם לא זהים ואי אפשר להשתמש בהם לסירוגין. הבדל אחד בסמנטיקה הוא שבאירועים חוזרים, לכל המופעים של אירוע אחד יש ערכי 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 של האירוע

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 — תאריך העדכון האחרון

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 – מיקום האירוע

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 — הסטטוס

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 – המזהה של היומן המקורי

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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[] – מערך שבו כל ערך תואם למספר הדקות לפני האירוע שבהן מופעלת תזכורת

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getSmsReminders()

מקבל את ערכי הדקות של כל התזכורות באירוע באמצעות SMS.

חזרה

Integer[] – מערך שבו כל ערך תואם למספר הדקות לפני האירוע שבהן מופעלת תזכורת

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getTag(key)

מחזירה את ערך התג של האירוע.

פרמטרים

שםסוגתיאור
keyStringהמפתח

חזרה

String – ערך התג

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

חזרה

String – הכותרת

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

getTransparency()

מקבל את השקיפות של האירוע. אפשר להשתמש בשיטה הזו כדי לקבוע אם אירוע מסוים הוא TRANSPARENT, כלומר היומן מראה שאתם פנויים בזמן הזה, או OPAQUE , כלומר היומן מראה שאתם עסוקים בזמן הזה.

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

חזרה

EventTransparency – ערך השקיפות.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 – ערך החשיפה

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 אם לא

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 אם לא

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 אם לא

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 אם לא

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

פרמטרים

שםסוגתיאור
emailStringכתובת האימייל של האורח

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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 לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setAnyoneCanAddSelf(anyoneCanAddSelf)

הגדרה שקובעת אם משתתפים שאינם אורחים יכולים להוסיף את עצמם לאירוע.

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

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

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

פרמטרים

שםסוגתיאור
anyoneCanAddSelfBooleanאם כל אחד יכול להזמין את עצמו

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setColor(color)

הגדרת הצבע של האירוע ביומן.

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

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

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

פרמטרים

שםסוגתיאור
colorStringאינדקס צבע של מספר שלם כמחרוזת, או ערך מ-CalendarApp.EventColor.

חזרה

CalendarEventSeries – האירוע הזה ביומן, לשרשור.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setDescription(description)

הגדרת תיאור האירוע.

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

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

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

פרמטרים

שםסוגתיאור
descriptionStringהתיאור החדש

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setGuestsCanInviteOthers(guestsCanInviteOthers)

קובעת אם המשתתפים יכולים להזמין משתתפים אחרים.

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

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

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

פרמטרים

שםסוגתיאור
guestsCanInviteOthersBooleanאם המשתתפים יכולים להזמין אנשים אחרים

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setGuestsCanModify(guestsCanModify)

הגדרה שקובעת אם האורחים יכולים לשנות את האירוע.

פרמטרים

שםסוגתיאור
guestsCanModifyBooleanהאם האורחים יכולים לשנות את האירוע

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setGuestsCanSeeGuests(guestsCanSeeGuests)

ההגדרה הזו קובעת אם המשתתפים יכולים לראות את שאר המשתתפים.

פרמטרים

שםסוגתיאור
guestsCanSeeGuestsBooleanאם האורחים יכולים לראות את האורחים האחרים

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setLocation(location)

הגדרת המיקום של האירוע.

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

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

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

פרמטרים

שםסוגתיאור
locationStringהמיקום החדש

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setMyStatus(status)

הפונקציה מגדירה את סטטוס האירוע (לדוגמה, משתתף או מוזמן) של המשתמש הרלוונטי.

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

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

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

פרמטרים

שםסוגתיאור
statusGuestStatusהסטטוס החדש

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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.
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);

פרמטרים

שםסוגתיאור
recurrenceEventRecurrenceכללי החזרה שבהם רוצים להשתמש
startDateDateהתאריך של האירוע הראשון בסדרה (המערכת משתמשת רק ביום ומתעלמת מהשעה)

חזרה

CalendarEventSeries — CalendarEventSeries הזה לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

  • 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.
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);

פרמטרים

שםסוגתיאור
recurrenceEventRecurrenceכללי החזרה שבהם רוצים להשתמש
startTimeDateהתאריך והשעה שבהם מתחיל האירוע הראשון בסדרה
endTimeDateהתאריך והשעה שבהם מסתיים האירוע הראשון בסדרה

חזרה

CalendarEventSeries — CalendarEventSeries הזה לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setTag(key, value)

מגדיר תג מפתח/ערך באירוע, כדי לאחסן מטא-נתונים מותאמים אישית.

פרמטרים

שםסוגתיאור
keyStringמפתח התג
valueStringערך התג

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

פרמטרים

שםסוגתיאור
titleStringהשם החדש

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setTransparency(transparency)

הגדרת השקיפות של האירוע. באמצעות השיטה הזו אפשר להגדיר אם האירוע הוא TRANSPARENT, כלומר היומן יראה כפנוי בזמן הזה, או OPAQUE , כלומר היומן יראה כעסוק בזמן הזה.

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

פרמטרים

שםסוגתיאור
transparencyEventTransparencyערך השקיפות.

חזרה

CalendarEventSeries — This CalendarEventSeries for chaining.

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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

setVisibility(visibility)

ההגדרה הזו קובעת את הרשאות הגישה של האירוע.

פרמטרים

שםסוגתיאור
visibilityVisibility

חזרה

CalendarEventSeriesCalendarEventSeries לשרשור

אישור

סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:

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