Class CalendarApp

יומןאפליקציה

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

מאפיינים

נכססוגתיאור
ColorColorסוג enum שמייצג את הצבעים עם השמות שזמינים בשירות היומן.
EventColorEventColorסוג enum שמייצג את הצבעים של האירועים שזמינים בשירות של יומן Google.
EventTransparencyEventTransparencyהספירה EventTransparency.
EventTypeEventTypeהספירה EventType.
GuestStatusGuestStatusסוג enum שמייצג את הסטטוסים שיכולים להיות לאורח באירוע.
MonthMonthסוג enum שמייצג את חודשי השנה.
VisibilityVisibilityסוג enum שמייצג את הרשאות הגישה של אירוע.
WeekdayWeekdayסוג enum שמייצג את ימי השבוע.

Methods

שיטהסוג הערך שמוחזרתיאור קצר
createAllDayEvent(title, date)CalendarEventיצירת אירוע חדש של יום שלם.
createAllDayEvent(title, startDate, endDate)CalendarEventיצירת אירוע חדש של יום שלם שיכול להימשך כמה ימים.
createAllDayEvent(title, startDate, endDate, options)CalendarEventיצירת אירוע חדש של יום שלם שיכול להימשך כמה ימים.
createAllDayEvent(title, date, options)CalendarEventיצירת אירוע חדש של יום שלם.
createAllDayEventSeries(title, startDate, recurrence)CalendarEventSeriesיצירת סדרה חדשה של אירועים של יום שלם.
createAllDayEventSeries(title, startDate, recurrence, options)CalendarEventSeriesיצירת סדרה חדשה של אירועים של יום שלם.
createCalendar(name)Calendarיוצר יומן חדש בבעלות המשתמש.
createCalendar(name, options)Calendarיוצר יומן חדש בבעלות המשתמש.
createEvent(title, startTime, endTime)CalendarEventיצירת אירוע חדש.
createEvent(title, startTime, endTime, options)CalendarEventיצירת אירוע חדש.
createEventFromDescription(description)CalendarEventיצירת אירוע מתיאור חופשי.
createEventSeries(title, startTime, endTime, recurrence)CalendarEventSeriesיצירת סדרה חדשה של אירועים.
createEventSeries(title, startTime, endTime, recurrence, options)CalendarEventSeriesיצירת סדרה חדשה של אירועים.
getAllCalendars()Calendar[]מקבל את כל היומנים שהמשתמש הוא הבעלים שלהם או שהוא מנוי אליהם.
getAllOwnedCalendars()Calendar[]מקבל את כל היומנים שבבעלות המשתמש.
getCalendarById(id)Calendar|nullמקבל את היומן עם המזהה הנתון.
getCalendarsByName(name)Calendar[]מקבל את כל היומנים עם שם נתון שהמשתמש הוא הבעלים שלהם או שהוא רשום אליהם.
getColor()Stringהפונקציה מחזירה את הצבע של היומן.
getDefaultCalendar()Calendarקבלת היומן שמוגדר כברירת מחדל של המשתמש.
getDescription()Stringמחזירה את התיאור של היומן.
getEventById(iCalId)CalendarEventמחזירה את האירוע עם המזהה הנתון.
getEventSeriesById(iCalId)CalendarEventSeriesמקבל את סדרת האירועים עם המזהה הנתון.
getEvents(startTime, endTime)CalendarEvent[]מקבל את כל האירועים שמתרחשים בטווח זמן נתון.
getEvents(startTime, endTime, options)CalendarEvent[]מקבל את כל האירועים שמתרחשים בטווח זמן נתון ועומדים בקריטריונים שצוינו.
getEventsForDay(date)CalendarEvent[]מחזירה את כל האירועים שמתרחשים ביום נתון.
getEventsForDay(date, options)CalendarEvent[]מקבל את כל האירועים שמתרחשים ביום מסוים ועומדים בקריטריונים שצוינו.
getId()Stringמקבל את המזהה של היומן.
getName()Stringהפונקציה מחזירה את השם של היומן.
getOwnedCalendarById(id)Calendar|nullמקבל את היומן עם המזהה הנתון, אם הוא בבעלות המשתמש.
getOwnedCalendarsByName(name)Calendar[]מקבל את כל היומנים עם שם נתון שבבעלות המשתמש.
getTimeZone()Stringהפונקציה מחזירה את אזור הזמן של היומן.
isHidden()Booleanההגדרה קובעת אם היומן מוסתר בממשק המשתמש.
isMyPrimaryCalendar()Booleanקובעת אם היומן הוא היומן הראשי של המשתמש הרלוונטי.
isOwnedByMe()Booleanהפונקציה קובעת אם היומן בבעלותכם.
isSelected()Booleanקובעת אם האירועים ביומן מוצגים בממשק המשתמש.
newRecurrence()EventRecurrenceיוצרת אובייקט חדש של חזרה, שאפשר להשתמש בו כדי ליצור כללים לחזרה של אירועים.
setColor(color)Calendarהגדרת הצבע של היומן.
setDescription(description)Calendarהגדרת התיאור של היומן.
setHidden(hidden)Calendarההגדרה קובעת אם היומן גלוי בממשק המשתמש.
setName(name)Calendarמגדיר את השם של היומן.
setSelected(selected)Calendarקובעת אם האירועים ביומן מוצגים בממשק המשתמש.
setTimeZone(timeZone)Calendarהגדרת אזור הזמן של היומן.
subscribeToCalendar(id)Calendarהמערכת רושמת את המשתמש ליומן עם המזהה שצוין, אם למשתמש יש הרשאה להירשם.
subscribeToCalendar(id, options)Calendarהמערכת רושמת את המשתמש ליומן עם המזהה שצוין, אם למשתמש יש הרשאה להירשם.

תיעוד מפורט

createAllDayEvent(title, date)

יצירת אירוע חדש של יום שלם.

// Creates an all-day event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969'),
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירוע.
dateDateתאריך האירוע (רק היום משמש; המערכת מתעלמת מהשעה).

חזרה

CalendarEvent – האירוע שנוצר.

אישור

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

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

createAllDayEvent(title, startDate, endDate)

יצירת אירוע חדש של יום שלם שיכול להימשך כמה ימים.

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and
// logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'),
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירוע.
startDateDateהתאריך שבו האירוע מתחיל (רק היום משמש; המערכת מתעלמת מהשעה).
endDateDateהתאריך שבו האירוע מסתיים (רק היום משמש; השעה מתעלמת). תאריך הסיום לא נכלל.

חזרה

CalendarEvent – האירוע שנוצר.

אישור

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

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

createAllDayEvent(title, startDate, endDate, options)

יצירת אירוע חדש של יום שלם שיכול להימשך כמה ימים.

// Creates an all-day event for the Woodstock festival (August 15th to 17th) and
// logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Woodstock Festival',
    new Date('August 15, 1969'),
    new Date('August 18, 1969'),
    {location: 'Bethel, White Lake, New York, U.S.', sendInvites: true},
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירוע.
startDateDateהתאריך שבו האירוע מתחיל (רק היום משמש; המערכת מתעלמת מהשעה).
endDateDateהתאריך שבו האירוע מסתיים (רק היום משמש; השעה מתעלמת). תאריך הסיום לא נכלל.
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך.

פרמטרים מתקדמים

שםסוגתיאור
descriptionStringתיאור האירוע.
locationStringהמיקום של האירוע.
guestsStringרשימה מופרדת בפסיקים של כתובות אימייל שצריך להוסיף כאורחים.
sendInvitesBooleanהאם לשלוח הזמנות באימייל (ברירת מחדל: false).

חזרה

CalendarEvent – האירוע שנוצר.

אישור

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

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

createAllDayEvent(title, date, options)

יצירת אירוע חדש של יום שלם.

// Creates an all-day event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createAllDayEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969'),
    {location: 'The Moon'},
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירוע.
dateDateתאריך האירוע (רק היום משמש; המערכת מתעלמת מהשעה).
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך.

פרמטרים מתקדמים

שםסוגתיאור
descriptionStringתיאור האירוע.
locationStringהמיקום של האירוע.
guestsStringרשימה מופרדת בפסיקים של כתובות אימייל שצריך להוסיף כאורחים.
sendInvitesBooleanהאם לשלוח הזמנות באימייל (ברירת מחדל: false).

חזרה

CalendarEvent – האירוע שנוצר.

אישור

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

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

createAllDayEventSeries(title, startDate, recurrence)

יצירת סדרה חדשה של אירועים של יום שלם.

// Creates an event series for a no-meetings day, taking place every Wednesday
// in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries(
    'No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
        .until(new Date('January 1, 2014')),
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

פרמטרים

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

חזרה

CalendarEventSeries — סדרת האירועים שנוצרה

אישור

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

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

createAllDayEventSeries(title, startDate, recurrence, options)

יצירת סדרה חדשה של אירועים של יום שלם.

// Creates an event series for a no-meetings day, taking place every Wednesday
// in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries(
    'No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
        .until(new Date('January 1, 2014')),
    {guests: 'everyone@example.com'},
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירועים בסדרה
startDateDateהתאריך של האירוע הראשון בסדרה (רק היום משמש; השעה לא רלוונטית)
recurrenceEventRecurrenceהגדרות החזרה של סדרת האירועים
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך

פרמטרים מתקדמים

שםסוגתיאור
descriptionStringהתיאור של האירועים בסדרה
locationStringהמיקום של האירועים בסדרה
guestsStringרשימה מופרדת בפסיקים של כתובות אימייל שצריך להוסיף כמשתתפים לאירועים בסדרה
sendInvitesBooleanהאם לשלוח הזמנות באימייל (ברירת מחדל: false)

חזרה

CalendarEventSeries — סדרת האירועים שנוצרה

אישור

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

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

createCalendar(name)

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

// Creates a new calendar named "Travel Plans".
const calendar = CalendarApp.createCalendar('Travel Plans');
Logger.log(
    'Created the calendar "%s", with the ID "%s".',
    calendar.getName(),
    calendar.getId(),
);

פרמטרים

שםסוגתיאור
nameStringהשם של היומן החדש

חזרה

Calendar — היומן החדש שנוצר

אישור

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

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

createCalendar(name, options)

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

// Creates a new calendar named "Travel Plans" with a description and color.
const calendar = CalendarApp.createCalendar('Travel Plans', {
  description: 'A calendar to plan my travel schedule.',
  color: CalendarApp.Color.BLUE,
});
Logger.log(
    'Created the calendar "%s", with the ID "%s".',
    calendar.getName(),
    calendar.getId(),
);

פרמטרים

שםסוגתיאור
nameStringהשם של היומן החדש
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך

פרמטרים מתקדמים

שםסוגתיאור
locationStringהמיקום של היומן
descriptionStringהתיאור של היומן
timeZoneStringאזור הזמן שבו היומן צריך להיות מוגדר, בפורמט 'long' (למשל, ‫"America/New_York", כמו שמופיע ב-Joda.org)
colorStringמחרוזת הקסדצימלית של צבע (‎#rrggbb) או ערך מתוך CalendarApp.Colors
hiddenBooleanאם היומן מוסתר בממשק המשתמש (ברירת מחדל: false)
selectedBooleanאם האירועים ביומן מוצגים בממשק המשתמש (ברירת מחדל: true)

חזרה

Calendar — היומן החדש שנוצר

אישור

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

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

createEvent(title, startTime, endTime)

יצירת אירוע חדש.

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

// Creates an event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 21, 1969 21:00:00 UTC'),
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירוע
startTimeDateהתאריך והשעה שבהם האירוע מתחיל
endTimeDateהתאריך והשעה שבהם האירוע מסתיים

חזרה

CalendarEvent – האירוע שנוצר

אישור

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

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

createEvent(title, startTime, endTime, options)

יצירת אירוע חדש.

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

// Creates an event for the moon landing and logs the ID.
const event = CalendarApp.getDefaultCalendar().createEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969 20:00:00 UTC'),
    new Date('July 20, 1969 21:00:00 UTC'),
    {location: 'The Moon'},
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירוע
startTimeDateהתאריך והשעה שבהם האירוע מתחיל
endTimeDateהתאריך והשעה שבהם האירוע מסתיים
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך

פרמטרים מתקדמים

שםסוגתיאור
descriptionStringתיאור האירוע
locationStringהמיקום של האירוע
guestsStringרשימה מופרדת בפסיקים של כתובות אימייל שצריך להוסיף כאורחים
sendInvitesBooleanהאם לשלוח הזמנות באימייל (ברירת מחדל: false)

חזרה

CalendarEvent – האירוע שנוצר

אישור

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

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

createEventFromDescription(description)

יצירת אירוע מתיאור חופשי.

התיאור צריך להיות באותו פורמט כמו התכונה "הוספה מהירה" בממשק המשתמש.

// Creates a new event and logs its ID.
const event = CalendarApp.getDefaultCalendar().createEventFromDescription(
    'Lunch with Mary, Friday at 1PM',
);
Logger.log(`Event ID: ${event.getId()}`);

פרמטרים

שםסוגתיאור
descriptionStringתיאור חופשי של האירוע

חזרה

CalendarEvent – האירוע שנוצר

אישור

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

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

createEventSeries(title, startTime, endTime, recurrence)

יצירת סדרה חדשה של אירועים.

// Creates an event series for a team meeting, taking place every Tuesday and
// Thursday in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createEventSeries(
    'Team Meeting',
    new Date('January 1, 2013 03:00:00 PM EST'),
    new Date('January 1, 2013 04:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekdays(
            [CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
        .until(new Date('January 1, 2014')),
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

פרמטרים

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

חזרה

CalendarEventSeries — סדרת האירועים שנוצרה

אישור

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

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

createEventSeries(title, startTime, endTime, recurrence, options)

יצירת סדרה חדשה של אירועים.

// Creates an event series for a team meeting, taking place every Tuesday and
// Thursday in 2013.
const eventSeries = CalendarApp.getDefaultCalendar().createEventSeries(
    'Team Meeting',
    new Date('January 1, 2013 03:00:00 PM EST'),
    new Date('January 1, 2013 04:00:00 PM EST'),
    CalendarApp.newRecurrence()
        .addWeeklyRule()
        .onlyOnWeekdays(
            [CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
        .until(new Date('January 1, 2014')),
    {location: 'Conference Room'},
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

פרמטרים

שםסוגתיאור
titleStringשם האירועים בסדרה
startTimeDateהתאריך והשעה שבהם מתחיל האירוע הראשון בסדרה
endTimeDateהתאריך והשעה שבהם מסתיים האירוע הראשון בסדרה
recurrenceEventRecurrenceהגדרות החזרה של סדרת האירועים
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך

פרמטרים מתקדמים

שםסוגתיאור
descriptionStringהתיאור של האירועים בסדרה
locationStringהמיקום של האירועים בסדרה
guestsStringרשימה מופרדת בפסיקים של כתובות אימייל שצריך להוסיף כמשתתפים לאירועים בסדרה
sendInvitesBooleanהאם לשלוח הזמנות באימייל (ברירת מחדל: false)

חזרה

CalendarEventSeries — סדרת האירועים שנוצרה

אישור

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

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

getAllCalendars()

מקבל את כל היומנים שהמשתמש הוא הבעלים שלהם או שהוא מנוי אליהם.

// Determines how many calendars the user can access.
const calendars = CalendarApp.getAllCalendars();
Logger.log(
    'This user owns or is subscribed to %s calendars.',
    calendars.length,
);

חזרה

Calendar[] — כל היומנים שהמשתמש יכול לגשת אליהם

אישור

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

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

getAllOwnedCalendars()

מקבל את כל היומנים שבבעלות המשתמש.

// Determines how many calendars the user owns.
const calendars = CalendarApp.getAllOwnedCalendars();
Logger.log('This user owns %s calendars.', calendars.length);

חזרה

Calendar[] — כל היומנים שבבעלות המשתמש

אישור

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

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

getCalendarById(id)

מקבל את היומן עם המזהה הנתון.

// Gets the public calendar "US Holidays" by ID.
const calendar = CalendarApp.getCalendarById(
    'en.usa#holiday@group.v.calendar.google.com',
);
Logger.log('The calendar is named "%s".', calendar.getName());

פרמטרים

שםסוגתיאור
idStringמזהה היומן

חזרה

Calendar|null – היומן עם המזהה שצוין, או null אם היומן לא קיים, אם למשתמש אין גישה אליו או אם המשתמש לא רשום ליומן

אישור

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

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

getCalendarsByName(name)

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

// Gets the public calendar named "US Holidays".
const calendars = CalendarApp.getCalendarsByName('US Holidays');
Logger.log('Found %s matching calendars.', calendars.length);

פרמטרים

שםסוגתיאור
nameStringשם היומן

חזרה

Calendar[] – כל היומנים עם השם הזה שהמשתמש יכול לגשת אליהם

אישור

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

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

getColor()

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

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

// Gets the color of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getColor() instead.
const calendarColor = calendar.getColor();
console.log(calendarColor);

חזרה

String – מחרוזת הקסדצימלית של צבע (‎#rrggbb).

אישור

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

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

getDefaultCalendar()

קבלת היומן שמוגדר כברירת מחדל של המשתמש.

// Determines the time zone of the user's default calendar.
const calendar = CalendarApp.getDefaultCalendar();
Logger.log(
    'My default calendar is set to the time zone "%s".',
    calendar.getTimeZone(),
);

חזרה

Calendar — היומן שמוגדר כברירת מחדל אצל המשתמש

אישור

סקריפטים שמשתמשים ב-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.
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Sets the description of the calendar to 'Test description.'
calendar.setDescription('Test description');

// Gets the description of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getDescription() instead.
const description = calendar.getDescription();
console.log(description);

חזרה

String – התיאור של היומן.

אישור

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

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

getEventById(iCalId)

מחזירה את האירוע עם המזהה הנתון. אם הסדרה שייכת ליומן שאינו היומן שמוגדר כברירת מחדל, צריך להפעיל את השיטה הזו מהיומן הזה. הקריאה getEventById(iCalId) מחזירה רק אירוע ביומן שמוגדר כברירת מחדל.

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

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

// Creates an event for the moon landing.
const event = calendar.createEvent(
    'Apollo 11 Landing',
    new Date('July 20, 1969 20:05:00 UTC'),
    new Date('July 20, 1969 20:17:00 UTC'),
);

// Gets the calendar event ID and logs it to the console.
const iCalId = event.getId();
console.log(iCalId);

// Gets the event by its ID and logs the title of the event to the console.
// For the default calendar, you can use CalendarApp.getEventById(iCalId)
// instead.
const myEvent = calendar.getEventById(iCalId);
console.log(myEvent.getTitle());

פרמטרים

שםסוגתיאור
iCalIdStringמזהה האירוע.

חזרה

CalendarEvent — האירוע עם המזהה הנתון, או null אם האירוע לא קיים או שלמשתמש אין גישה אליו.

אישור

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

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

getEventSeriesById(iCalId)

מקבל את סדרת האירועים עם המזהה הנתון. אם המזהה שניתן הוא של CalendarEvent יחיד, מוחזר CalendarEventSeries עם אירוע יחיד בסדרה. שימו לב שאם סדרת האירועים שייכת ליומן שאינו יומן ברירת המחדל, צריך להפעיל את ה-method הזו מתוך CalendarApp. הפעלה ישירה של getEventSeriesById(iCalId) תחזיר רק סדרת אירועים שקיימת ביומן ברירת המחדל.

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

// Creates an event series for a daily team meeting from 1 PM to 2 PM.
// The series adds the daily event from January 1, 2023 through December 31,
// 2023.
const eventSeries = calendar.createEventSeries(
    'Team meeting',
    new Date('Jan 1, 2023 13:00:00'),
    new Date('Jan 1, 2023 14:00:00'),
    CalendarApp.newRecurrence().addDailyRule().until(new Date('Jan 1, 2024')),
);

// Gets the ID of the event series.
const iCalId = eventSeries.getId();

// Gets the event series by its ID and logs the series title to the console.
// For the default calendar, you can use CalendarApp.getEventSeriesById(iCalId)
// instead.
console.log(calendar.getEventSeriesById(iCalId).getTitle());

פרמטרים

שםסוגתיאור
iCalIdStringהמזהה של סדרת האירועים.

חזרה

CalendarEventSeries – הסדרה עם המזהה הנתון, או null אם הסדרה לא קיימת או אם למשתמש אין גישה אליה.

אישור

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

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

getEvents(startTime, endTime)

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

השיטה הזו מחזירה אירועים שמתחילים במהלך טווח הזמן שצוין, מסתיימים במהלך טווח הזמן או כוללים את טווח הזמן. אם לא מציינים אזור זמן, ערכי הזמן מתפרשים בהקשר של אזור הזמן של הסקריפט, שיכול להיות שונה מאזור הזמן של היומן.

// Determines how many events are happening in the next two hours.
const now = new Date();
const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000);
const events = CalendarApp.getDefaultCalendar().getEvents(now, twoHoursFromNow);
Logger.log(`Number of events: ${events.length}`);

פרמטרים

שםסוגתיאור
startTimeDateתחילת טווח הזמן
endTimeDateסוף טווח הזמן, לא כולל

חזרה

CalendarEvent[] — האירועים שמתרחשים בטווח הזמן

אישור

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

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

getEvents(startTime, endTime, options)

מקבל את כל האירועים שמתרחשים בטווח זמן נתון ועומדים בקריטריונים שצוינו.

השיטה הזו מחזירה אירועים שמתחילים במהלך טווח הזמן הנתון, מסתיימים במהלך טווח הזמן או כוללים את טווח הזמן. אם לא מציינים אזור זמן, ערכי הזמן מתפרשים בהקשר של אזור הזמן של הסקריפט, שיכול להיות שונה מאזור הזמן של היומן.

חשוב לדעת: הסינון ב-author, ב-search או ב-statusFilters מתבצע אחרי ההחלה של start ושל max. המשמעות היא שמספר האירועים שמוחזרים עשוי להיות קטן מ-max, גם אם יש אירועים נוספים שעומדים בקריטריונים.

// Determines how many events are happening in the next two hours that contain
// the term "meeting".
const now = new Date();
const twoHoursFromNow = new Date(now.getTime() + 2 * 60 * 60 * 1000);
const events = CalendarApp.getDefaultCalendar().getEvents(
    now,
    twoHoursFromNow,
    {search: 'meeting'},
);
Logger.log(`Number of events: ${events.length}`);

פרמטרים

שםסוגתיאור
startTimeDateתחילת טווח הזמן
endTimeDateסוף טווח הזמן, לא כולל
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך

פרמטרים מתקדמים

שםסוגתיאור
startIntegerהאינדקס של האירוע הראשון להחזרה
maxIntegerהמספר המקסימלי של אירועים שיוחזרו
authorStringכתובת אימייל שמשמשת לסינון התוצאות לפי יוצר האירוע
searchStringשאילתת חיפוש בטקסט מלא שמשמשת לסינון תוצאות
statusFilters[]GuestStatusמערך של סטטוסים שמשמש לסינון התוצאות

חזרה

CalendarEvent[] — האירועים שמתרחשים בטווח הזמן ותואמים לקריטריונים

אישור

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

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

getEventsForDay(date)

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

השיטה הזו מחזירה אירועים אם הם מתחילים במהלך היום שצוין, מסתיימים במהלך היום או נמשכים לאורך כל היום.

הערה: נעשה שימוש רק בחלק של התאריך באובייקט Date, והמערכת מתעלמת מחלק השעה. התאריך מתורגם לחצות באותו יום עד חצות ביום שלמחרת באזור הזמן של היומן.

// Determines how many events are happening today.
const today = new Date();
const events = CalendarApp.getDefaultCalendar().getEventsForDay(today);
Logger.log(`Number of events: ${events.length}`);

פרמטרים

שםסוגתיאור
dateDateהתאריך של האירועים שרוצים לאחזר (רק היום משמש, המערכת מתעלמת מהשעה)

חזרה

CalendarEvent[] — האירועים שמתרחשים בתאריך הנתון

אישור

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

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

getEventsForDay(date, options)

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

השיטה הזו מחזירה אירועים אם הם מתחילים במהלך היום שצוין, מסתיימים במהלך היום או נמשכים לאורך כל היום.

הערה: נעשה שימוש רק בחלק של התאריך באובייקט Date, והמערכת מתעלמת מחלק השעה. התאריך מתורגם לחצות באותו יום עד חצות ביום שלמחרת באזור הזמן של היומן.

חשוב לדעת: הסינון ב-author, ב-search או ב-statusFilters מתבצע אחרי ההחלה של start ושל max. המשמעות היא שמספר האירועים שמוחזרים יכול להיות קטן מ-max, גם אם יש אירועים נוספים שעומדים בקריטריונים.

// Determines how many events are happening today and contain the term
// "meeting".
const today = new Date();
const events = CalendarApp.getDefaultCalendar().getEventsForDay(today, {
  search: 'meeting',
});
Logger.log(`Number of events: ${events.length}`);

פרמטרים

שםסוגתיאור
dateDateהתאריך של האירועים שרוצים לאחזר (רק היום משמש, המערכת מתעלמת מהשעה)
optionsObjectאפשרויות סינון מתקדמות

פרמטרים מתקדמים

שםסוגתיאור
startIntegerהאינדקס של האירוע הראשון להחזרה
maxIntegerהמספר המקסימלי של אירועים שיוחזרו
authorStringכתובת אימייל שמשמשת לסינון התוצאות לפי יוצר האירוע
searchStringשאילתת חיפוש בטקסט מלא שמשמשת לסינון תוצאות
statusFilters[]GuestStatusמערך של סטטוסים שמשמש לסינון התוצאות

חזרה

CalendarEvent[] — האירועים שמתרחשים בתאריך הנתון ועומדים בקריטריונים

אישור

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

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

getId()

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

// Opens the calendar by its ID.
// To get the user's default calendar, use CalendarApp.getDefaultCalendar().
// TODO(developer): Replace the ID with your own.
const calendar = CalendarApp.getCalendarById('222larabrown@gmail.com');

// Gets the ID of the calendar and logs it to the console.
const calendarId = calendar.getId();
console.log(calendarId);

חזרה

String – המזהה של היומן.

אישור

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

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

getName()

הפונקציה מחזירה את השם של היומן.

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

// Gets the name of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getName() instead.
const calendarName = calendar.getName();
console.log(calendarName);

חזרה

String – השם של היומן הזה.

אישור

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

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

getOwnedCalendarById(id)

מקבל את היומן עם המזהה הנתון, אם הוא בבעלות המשתמש.

כדי למצוא את מזהה היומן, לוחצים על החץ ליד שם היומן ביומן Google ובוחרים באפשרות הגדרות היומן. המזהה מוצג בחלק התחתון של דף ההגדרות.

// Gets a (non-existent) private calendar by ID.
const calendar = CalendarApp.getOwnedCalendarById(
    '123456789@group.calendar.google.com',
);
Logger.log('The calendar is named "%s".', calendar.getName());

פרמטרים

שםסוגתיאור
idStringמזהה היומן

חזרה

Calendar|null – היומן עם המזהה שצוין, או null אם היומן לא קיים או שהמשתמש לא הבעלים שלו

אישור

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

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

getOwnedCalendarsByName(name)

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

// Gets a private calendar named "Travel Plans".
const calendars = CalendarApp.getOwnedCalendarsByName('Travel Plans');
Logger.log('Found %s matching calendars.', calendars.length);

פרמטרים

שםסוגתיאור
nameStringשם היומן

חזרה

Calendar[] – כל היומנים עם השם הזה שבבעלות המשתמש

אישור

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

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

getTimeZone()

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

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

// Gets the time zone of the calendar and logs it to the console.
// For the default calendar, you can use CalendarApp.getTimeZone() instead.
const timeZone = calendar.getTimeZone();
console.log(timeZone);

חזרה

String – אזור הזמן, בפורמט 'ארוך' (לדוגמה, America/New_York, כמו שמופיע ב-Joda.org).

אישור

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

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

isHidden()

ההגדרה קובעת אם היומן מוסתר בממשק המשתמש.

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

// Determines whether the calendar is hidden in the user interface and logs it
// to the console. For the default calendar, you can use CalendarApp.isHidden()
// instead.
const isHidden = calendar.isHidden();
console.log(isHidden);

חזרה

Booleantrue אם היומן מוסתר בממשק המשתמש, false אם הוא לא מוסתר.

אישור

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

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

isMyPrimaryCalendar()

קובעת אם היומן הוא היומן הראשי של המשתמש הרלוונטי.

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

// Determines whether the calendar is the default calendar for
// the effective user and logs it to the console.
// For the default calendar, you can use CalendarApp.isMyPrimaryCalendar()
// instead.
const isMyPrimaryCalendar = calendar.isMyPrimaryCalendar();
console.log(isMyPrimaryCalendar);

חזרה

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

הפונקציה קובעת אם היומן בבעלותכם.

// Gets a calendar by its ID. To get the user's default calendar, use
// CalendarApp.getDefault() instead.
// TODO(developer): Replace the ID with the calendar ID that you want to use.
const calendar = CalendarApp.getCalendarById(
    'abc123456@group.calendar.google.com',
);

// Determines whether the calendar is owned by you and logs it.
console.log(calendar.isOwnedByMe());

חזרה

Booleantrue אם היומן בבעלותכם, false אם לא.

אישור

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

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

isSelected()

קובעת אם האירועים ביומן מוצגים בממשק המשתמש.

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

// Determines whether the calendar's events are displayed in the user interface
// and logs it.
console.log(calendar.isSelected());

חזרה

Booleantrue אם האירועים ביומן מוצגים בממשק המשתמש; false אם לא

אישור

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

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

newRecurrence()

יוצרת אובייקט חדש של חזרה, שאפשר להשתמש בו כדי ליצור כללים לחזרה של אירועים.

// Creates an event series for a no-meetings day, taking place every Wednesday
// in 2013.
const recurrence = CalendarApp.newRecurrence()
                       .addWeeklyRule()
                       .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
                       .until(new Date('January 1, 2014'));
const eventSeries = CalendarApp.getDefaultCalendar().createAllDayEventSeries(
    'No Meetings',
    new Date('January 2, 2013 03:00:00 PM EST'),
    recurrence,
);
Logger.log(`Event Series ID: ${eventSeries.getId()}`);

חזרה

EventRecurrence – אובייקט חדש של חזרה ללא כללים מוגדרים (ההתנהגות היא של חזרה שבועית)

אישור

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

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

setColor(color)

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

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

// Sets the color of the calendar to pink using the Calendar Color enum.
// For the default calendar, you can use CalendarApp.setColor() instead.
calendar.setColor(CalendarApp.Color.PINK);

פרמטרים

שםסוגתיאור
colorStringCalendarApp.Color או מחרוזת של קוד צבע הקסדצימלי (‎#rrggbb).

חזרה

Calendar – היומן הזה לשרשור.

אישור

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

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

setDescription(description)

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

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

// Sets the description of the calendar.
// TODO(developer): Update the string with the description that you want to use.
calendar.setDescription('Updated calendar description.');

פרמטרים

שםסוגתיאור
descriptionStringהתיאור של היומן הזה

חזרה

Calendar – היומן הזה לשרשור

אישור

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

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

setHidden(hidden)

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

פרמטרים

שםסוגתיאור
hiddenBooleantrue כדי להסתיר את היומן בממשק המשתמש, false כדי להציג אותו

חזרה

Calendar – היומן הזה לשרשור

אישור

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

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

setName(name)

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

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

// Sets the name of the calendar.
// TODO(developer): Update the string with the name that you want to use.
calendar.setName('Example calendar name');

פרמטרים

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

חזרה

Calendar – היומן הזה לשרשור

אישור

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

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

setSelected(selected)

קובעת אם האירועים ביומן מוצגים בממשק המשתמש.

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

// Selects the calendar so that its events are displayed in the user interface.
// To unselect the calendar, set the parameter to false.
calendar.setSelected(true);

פרמטרים

שםסוגתיאור
selectedBooleantrue כדי להציג את האירועים ביומן בממשק המשתמש, false כדי להסתיר אותם

חזרה

Calendar – היומן הזה לשרשור

אישור

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

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

setTimeZone(timeZone)

הגדרת אזור הזמן של היומן.

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

// Sets the time zone of the calendar to America/New York (US/Eastern) time.
calendar.setTimeZone('America/New_York');

פרמטרים

שםסוגתיאור
timeZoneStringאזור הזמן, שמוגדר בפורמט 'ארוך' (למשל, America/New_York, כמו שמופיע ב-Joda.org).

חזרה

Calendar – היומן הזה לשרשור.

אישור

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

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

subscribeToCalendar(id)

המערכת רושמת את המשתמש ליומן עם המזהה שצוין, אם למשתמש יש הרשאה להירשם.

// Subscribe to the calendar "US Holidays".
const calendar = CalendarApp.subscribeToCalendar(
    'en.usa#holiday@group.v.calendar.google.com',
);
Logger.log('Subscribed to the calendar "%s".', calendar.getName());

פרמטרים

שםסוגתיאור
idStringהמזהה של היומן שאליו רוצים להירשם

חזרה

Calendar – היומן החדש שאליו נרשמתם

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

Error – אם לא קיים יומן עם המזהה הזה

אישור

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

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

subscribeToCalendar(id, options)

המערכת רושמת את המשתמש ליומן עם המזהה שצוין, אם למשתמש יש הרשאה להירשם.

// Subscribe to the calendar "US Holidays", and set it to the color blue.
const calendar = CalendarApp.subscribeToCalendar(
    'en.usa#holiday@group.v.calendar.google.com',
    {color: CalendarApp.Color.BLUE},
);
Logger.log('Subscribed to the calendar "%s".', calendar.getName());

פרמטרים

שםסוגתיאור
idStringהמזהה של היומן שאליו רוצים להירשם.
optionsObjectאובייקט JavaScript שמציין פרמטרים מתקדמים, כמו אלה שמופיעים בהמשך.

פרמטרים מתקדמים

שםסוגתיאור
colorStringמחרוזת של קוד צבע הקסדצימלי (‎#rrggbb) או ערך מתוך CalendarApp.Colors.
hiddenBooleanאם היומן מוסתר בממשק המשתמש (ברירת מחדל: false).
selectedBooleanהאם האירועים ביומן מוצגים בממשק המשתמש (ברירת מחדל: true אם מצוין גם color, אחרת false).

חזרה

Calendar – היומן החדש שנרשמתם אליו.

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

Error – אם לא קיים יומן עם המזהה הזה

אישור

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

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