מייצג אירוע יחיד ביומן.
Methods
| שיטה | סוג הערך שמוחזר | תיאור קצר |
|---|---|---|
add | Calendar | הוספת תזכורת חדשה באימייל לאירוע. |
add | Calendar | הוספת משתתפים לאירוע. |
add | Calendar | הוספת תזכורת קופצת חדשה לאירוע. |
add | Calendar | הוספת תזכורת חדשה לאירוע באמצעות SMS. |
anyone | Boolean | ההגדרה הזו קובעת אם אנשים יכולים להוסיף את עצמם כמשתתפים לאירוע ביומן. |
delete | void | מחיקת אירוע ביומן. |
delete | Calendar | מוחק תג מפתח/ערך מהאירוע. |
get | Date | מחזירה את התאריך שבו מסתיים האירוע הזה ביומן שנמשך כל היום. |
get | Date | מחזירה את התאריך שבו מתחיל האירוע הזה ביומן שנמשך כל היום. |
get | String[] | מחזירה את כל המפתחות של התגים שהוגדרו באירוע. |
get | String | מחזירה את הצבע של האירוע ביומן. |
get | String[] | מחזירה את היוצרים של אירוע. |
get | Date | מחזירה את התאריך שבו נוצר האירוע. |
get | String | מקבל את תיאור האירוע. |
get | Integer[] | מחזירה את ערכי הדקות של כל התזכורות באימייל לאירוע. |
get | Date | מחזירה את התאריך והשעה שבהם האירוע הזה ביומן מסתיים. |
get | Calendar | מחזירה את סדרת האירועים החוזרים שהאירוע הזה שייך אליה. |
get | Event | הפונקציה מחזירה את ה-Event של האירוע הזה. |
get | Event | מקבל אורח לפי כתובת אימייל. |
get | Event | מקבל את המשתתפים באירוע, לא כולל את הבעלים של האירוע. |
get | Event | מקבל את המשתתפים באירוע, כולל בעלי האירוע. |
get | String | מחזירה את המזהה הייחודי של האירוע ב-iCal. |
get | Date | מחזירה את התאריך שבו האירוע עודכן לאחרונה. |
get | String | הפונקציה מחזירה את המיקום של האירוע. |
get | Guest | מקבל את סטטוס האירוע (לדוגמה, משתתף או מוזמן) של המשתמש הרלוונטי. |
get | String | קבלת המזהה של היומן שבו האירוע הזה נוצר במקור. |
get | Integer[] | מחזירה את ערכי הדקות של כל התזכורות הקופצות לאירוע. |
get | Integer[] | מקבל את ערכי הדקות של כל התזכורות באירוע באמצעות SMS. |
get | Date | מחזירה את התאריך והשעה שבהם מתחיל האירוע ביומן. |
get | String | מחזירה את ערך התג של האירוע. |
get | String | מחזירה את שם האירוע. |
get | Event | מקבל את השקיפות של האירוע. |
get | Visibility | מקבל את הרשאות הגישה של האירוע. |
guests | Boolean | קובעת אם המשתתפים יכולים להזמין משתתפים אחרים. |
guests | Boolean | קובעת אם האורחים יכולים לשנות את האירוע. |
guests | Boolean | קובעת אם האורחים יכולים לראות את האורחים האחרים. |
is | Boolean | קובע אם מדובר באירוע של יום שלם. |
is | Boolean | בודק אם אתם הבעלים של האירוע. |
is | Boolean | קובע אם האירוע הוא חלק מסדרת אירועים. |
remove | Calendar | כל התזכורות יוסרו מהאירוע. |
remove | Calendar | הסרת משתתף מהאירוע. |
reset | Calendar | מאפס את התזכורות באמצעות הגדרות ברירת המחדל של היומן. |
set | Calendar | הגדרת התאריך של האירוע. |
set | Calendar | הגדרת התאריכים של האירוע. |
set | Calendar | הגדרה שקובעת אם משתתפים שאינם אורחים יכולים להוסיף את עצמם לאירוע. |
set | Calendar | הגדרת הצבע של האירוע ביומן. |
set | Calendar | הגדרת תיאור האירוע. |
set | Calendar | קובעת אם המשתתפים יכולים להזמין משתתפים אחרים. |
set | Calendar | הגדרה שקובעת אם האורחים יכולים לשנות את האירוע. |
set | Calendar | ההגדרה הזו קובעת אם המשתתפים יכולים לראות את שאר המשתתפים. |
set | Calendar | הגדרת המיקום של האירוע. |
set | Calendar | הפונקציה מגדירה את סטטוס האירוע (לדוגמה, משתתף או מוזמן) של המשתמש הרלוונטי. |
set | Calendar | מגדיר תג מפתח/ערך באירוע, כדי לאחסן מטא-נתונים מותאמים אישית. |
set | Calendar | מגדיר את התאריכים והשעות של ההתחלה והסיום של האירוע. |
set | Calendar | הגדרת שם האירוע. |
set | Calendar | הגדרת השקיפות של האירוע. |
set | Calendar | ההגדרה הזו קובעת את הרשאות הגישה של האירוע. |
תיעוד מפורט
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);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
minutes | Integer | מספר הדקות לפני האירוע |
חזרה
CalendarEvent — CalendarEvent לשרשור
מקפיצה את הודעות השגיאה (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); } }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
email | String | כתובת האימייל של האורח. |
חזרה
CalendarEvent — This CalendarEvent 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);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
minutes | Integer | מספר הדקות לפני האירוע |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
addSmsReminder(minutesBefore)
הוספת תזכורת חדשה לאירוע באמצעות SMS. התזכורת צריכה להיות לפחות 5 דקות ולכל היותר 4 שבועות (40,320 דקות) לפני האירוע.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
minutes | Integer | מספר הדקות לפני האירוע |
חזרה
CalendarEvent — CalendarEvent לשרשור
מקפיצה את הודעות השגיאה (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());
חזרה
Boolean – true אם משתתפים שלא הוזמנו יכולים להוסיף את עצמם לאירוע, false אם לא
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
https://www.google.com/calendar/feeds
deleteEvent()
מחיקת אירוע ביומן.
// Gets an event by its ID. // TODO(developer): Replace the string with the ID of the event that you want to // delete. const event = CalendarApp.getEventById('abc123456'); // Deletes the event. event.deleteEvent();
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
deleteTag(key)
מוחק תג מפתח/ערך מהאירוע.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
key | String | מפתח התג |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
getAllDayEndDate()
מחזירה את התאריך שבו מסתיים האירוע הזה ביומן שנמשך כל היום. (אם האירוע אינו אירוע של יום שלם, השיטה הזו זורקת חריגה). הערך Date שמוחזר מייצג את חצות בתחילת היום שאחרי סיום האירוע באזור הזמן של הסקריפט. כדי להשתמש באזור הזמן של היומן במקום זאת, קוראים ל-getEndTime().
// Gets the user's default calendar. To get a different calendar, // use getCalendarById() instead. const calendar = CalendarApp.getDefaultCalendar(); // Creates an event named 'My all-day event' for May 16, 2023. const event = calendar.createAllDayEvent( 'My all-day event', new Date('May 16, 2023'), ); // Gets the event's end date and logs it. const endDate = event.getAllDayEndDate(); console.log(endDate);
חזרה
Date – תאריך הסיום של האירוע הזה ביומן שנמשך כל היום
מקפיצה את הודעות השגיאה (Throws)
Error – אם האירוע לא נמשך כל היום
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
https://www.google.com/calendar/feeds
getAllDayStartDate()
מחזירה את התאריך שבו מתחיל האירוע הזה ביומן שנמשך כל היום. (אם האירוע לא נמשך כל היום, השיטה הזו מחזירה חריגה). הערך Date שמוחזר מייצג את חצות בתחילת היום שבו האירוע מתחיל באזור הזמן של הסקריפט. כדי להשתמש באזור הזמן של היומן במקום זאת, קוראים ל-getStartTime().
// Gets the user's default calendar. To get a different calendar, // use getCalendarById() instead. const calendar = CalendarApp.getDefaultCalendar(); // Creates an event named 'My all-day event' for May 16, 2023. const event = calendar.createAllDayEvent( 'My all-day event', new Date('May 16, 2023'), ); // Gets the event's start date and logs it. const startDate = event.getAllDayStartDate(); console.log(startDate);
חזרה
Date – תאריך ההתחלה של האירוע ביומן שנמשך כל היום
מקפיצה את הודעות השגיאה (Throws)
Error – אם האירוע לא נמשך כל היום
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
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
getEndTime()
מחזירה את התאריך והשעה שבהם האירוע הזה ביומן מסתיים. צריכה להיות לכם גישה ליומן. לאירועים שלא נמשכים יום שלם, זהו הרגע שבו האירוע הוגדר להסתיים. באירועים שנמשכים יום שלם, שבהם נשמר רק תאריך הסיום (ולא תאריך ושעה), זהו חצות בתחילת היום שאחרי סיום האירוע באזור הזמן של היומן. כך אפשר להשוות בין זמני הסיום של כל סוגי האירועים, אבל לא בהכרח לשמור על היום המקורי בשנה ללא שינוי.
במקרה של אירועים של יום שלם, כמעט תמיד עדיף לקרוא לשיטה getAllDayEndDate() במקום לשיטה הזו.
// 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 1st, 2023 that takes // place between 4:00 PM and 5:00 PM. const event = calendar.getEvents( new Date('Feb 01, 2023 16:00:00'), new Date('Feb 01, 2023 17:00:00'), )[0]; if (event) { // If an event exists within the given time frame, gets the date and time at // which the event ends and logs it. console.log(event.getEndTime()); } else { // If no event exists within the given time frame, logs that info 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
getEventSeries()
מחזירה את סדרת האירועים החוזרים שהאירוע הזה שייך אליה. צריכה להיות לכם גישה ליומן. אובייקט CalendarEventSeries מוחזר גם אם האירוע הזה לא שייך לסדרה, כדי שתוכלו להוסיף הגדרות חדשות של חזרה.
// 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 18th, 2023 that takes // place between 1:00 PM and 2:00 PM. const event = calendar.getEvents( new Date('Feb 18, 2023 13:00:00'), new Date('Feb 18, 2023 14:00:00'), )[0]; if (event) { // If an event exists within the given time frame, gets the event series for // the event and sets the color to pale green. event.getEventSeries().setColor(CalendarApp.EventColor.PALE_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'); }
חזרה
CalendarEventSeries – סדרת האירועים שאליה האירוע הזה שייך, או סדרת אירועים חדשה אם הוא עדיין לא שייך לסדרה
אישור
סקריפטים שמשתמשים ב-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()); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
email | String | הכתובת של האורח |
חזרה
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()); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
include | Boolean | אם לכלול את הבעלים כאורחים |
חזרה
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
getStartTime()
מחזירה את התאריך והשעה שבהם מתחיל האירוע ביומן. לאירועים שלא נמשכים יום שלם, זהו הרגע שבו האירוע הוגדר להתחיל. לאירועים שנמשכים יום שלם, שבהם נשמר רק תאריך התחלה (ולא תאריך ושעה), השעה היא חצות בתחילת היום שבו האירוע מתחיל באזור הזמן של היומן. ההגדרה הזו מאפשרת השוואה משמעותית של זמני ההתחלה של כל סוגי האירועים, אבל היא לא בהכרח שומרת על היום המקורי בשנה ללא שינוי.
במקרה של אירועים שנמשכים יום שלם, כמעט תמיד עדיף לקרוא לשיטה getAllDayStartDate() במקום לשיטה הזו.
// 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. const event = calendar.getEvents( new Date('Feb 01, 2023 16:10:00'), new Date('Feb 01, 2023 16:25:00'), )[0]; // Gets the date and time at which this calendar event begins and logs it. const startTime = event.getStartTime(); console.log(startTime);
חזרה
Date – שעת ההתחלה של האירוע ביומן
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
https://www.google.com/calendar/feeds
getTag(key)
מחזירה את ערך התג של האירוע.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
key | String | המפתח |
חזרה
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'); }
חזרה
Boolean — true אם המשתתפים יכולים להזמין אנשים אחרים; 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'); }
חזרה
Boolean — true אם האורחים יכולים לשנות את האירוע; 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'); }
חזרה
Boolean – true אם המשתתפים יכולים לראות את שאר המשתתפים; false אם לא
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
https://www.google.com/calendar/feeds
isAllDayEvent()
קובע אם מדובר באירוע של יום שלם.
// 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. const event = calendar.getEvents( new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'), )[0]; // Determines whether this event is an all-day event and logs it. console.log(event.isAllDayEvent());
חזרה
Boolean — true אם האירוע נמשך כל היום; 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'); }
חזרה
Boolean – true אם האירוע נמצא בבעלות המשתמש המשולב, false אם לא
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
https://www.google.com/calendar/feeds
isRecurringEvent()
קובע אם האירוע הוא חלק מסדרת אירועים.
// 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 Januart 31st, 2023 that takes // place between 9:00 AM and 10:00 AM. const event = calendar.getEvents( new Date('Jan 31, 2023 09:00:00'), new Date('Jan 31, 2023 10:00:00'), )[0]; if (event) { // If an event exists within the given time frame, determines whether the // event is part of an event series and logs it. console.log(event.isRecurringEvent()); } 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'); }
חזרה
Boolean – true אם האירוע הוא חלק מסדרת אירועים; 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'); }
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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); } }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
email | String | כתובת האימייל של האורח |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setAllDayDate(date)
הגדרת התאריך של האירוע. השיטה הזו משנה אירוע רגיל לאירוע של יום שלם.
// 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 17th, 2023 that takes // place between 4:00 PM and 5:00 PM. const event = calendar.getEvents( new Date('Feb 17, 2023 16:00:00'), new Date('Feb 17, 2023 17:00:00'), )[0]; if (event) { // If an event exists within the given time frame, sets the date of the event // and updates it to an all-day event. event.setAllDayDate(new Date('Feb 17, 2023')); } 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 | Date | התאריך של האירוע (המערכת מתעלמת מהשעה) |
חזרה
CalendarEvent — CalendarEvent הזה לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setAllDayDates(startDate, endDate)
הגדרת התאריכים של האירוע. השימוש בשיטה הזו משנה אירוע רגיל לאירוע שנמשך כל היום.
// 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 18th, 2023 that takes // place between 4:00 PM and 5:00 PM. const event = calendar.getEvents( new Date('Feb 18, 2023 16:00:00'), new Date('Feb 18, 2023 17:00:00'), )[0]; if (event) { // If an event exists within the given time frame, sets the event to be an // all-day event from Feb 18th, 2023 until Feb 25th, 2023. Applying this // method changes a regular event into an all-day event. event.setAllDayDates(new Date('Feb 18, 2023'), new Date('Feb 25, 2023')); } 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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
start | Date | התאריך שבו האירוע מתחיל (השעה לא רלוונטית) |
end | Date | התאריך שבו האירוע מסתיים (השעה לא רלוונטית) |
חזרה
CalendarEvent — CalendarEvent הזה לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
anyone | Boolean | אם כל אחד יכול להזמין את עצמו |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
color | String | אינדקס צבע של מספר שלם כמחרוזת, או ערך מ-Calendar. |
חזרה
CalendarEvent – האירוע הזה ביומן, לשרשור.
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
description | String | התיאור החדש |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
guests | Boolean | אם המשתתפים יכולים להזמין אנשים אחרים |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setGuestsCanModify(guestsCanModify)
הגדרה שקובעת אם האורחים יכולים לשנות את האירוע.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
guests | Boolean | האם האורחים יכולים לשנות את האירוע |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setGuestsCanSeeGuests(guestsCanSeeGuests)
ההגדרה הזו קובעת אם המשתתפים יכולים לראות את שאר המשתתפים.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
guests | Boolean | אם האורחים יכולים לראות את האורחים האחרים |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
location | String | המיקום החדש |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
status | Guest | הסטטוס החדש |
חזרה
CalendarEvent — this CalendarEvent for chaining
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.googleapis.com/auth/calendar.readonly -
https://www.google.com/calendar/feeds
setTag(key, value)
מגדיר תג מפתח/ערך באירוע, כדי לאחסן מטא-נתונים מותאמים אישית.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
key | String | מפתח התג |
value | String | ערך התג |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setTime(startTime, endTime)
מגדיר את התאריכים והשעות של ההתחלה והסיום של האירוע. השימוש בשיטה הזו משנה אירוע של יום שלם לאירוע רגיל.
// Opens the calendar by its ID. // TODO(developer): Replace the ID with your own. const calendar = CalendarApp.getCalendarById( 'abc123456@group.calendar.google.com', ); // Declares a start time of 11:00 AM on February 20th, 2023 and an end time of // 12:00 PM on February 20th, 2023. const startTime = new Date('Feb 20,2023 11:00:00'); const endTime = new Date('Feb 20, 2023 12:00:00'); // Creates an all-day event on February 20th, 2023. const event = calendar.createAllDayEvent('Meeting', new Date('Feb 20,2023')); // Updates the all-day event to a regular event by setting a start and end time // for the event. event.setTime(startTime, endTime);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
start | Date | התחלה חדשה של האירוע |
end | Date | השעה החדשה של סיום האירוע |
חזרה
CalendarEvent — CalendarEvent הזה לשרשור
אישור
סקריפטים שמשתמשים ב-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'); }
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
title | String | השם החדש |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-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);
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
transparency | Event | ערך השקיפות. |
חזרה
CalendarEvent — This CalendarEvent for chaining.
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds
setVisibility(visibility)
ההגדרה הזו קובעת את הרשאות הגישה של האירוע.
פרמטרים
| שם | סוג | תיאור |
|---|---|---|
visibility | Visibility |
חזרה
CalendarEvent — CalendarEvent לשרשור
אישור
סקריפטים שמשתמשים ב-method הזה צריכים הרשאה עם אחת או יותר מהיקפים הבאים או היקפים מתאימים מה-API בארכיטקטורת REST שקשור:
-
https://www.googleapis.com/auth/calendar -
https://www.google.com/calendar/feeds