מייצג אירוע אחד ביומן.
שיטות
שיטה | סוג הערך שמוחזר | תיאור קצר |
---|---|---|
addEmailReminder(minutesBefore) | CalendarEvent | הוספת תזכורת חדשה באימייל לאירוע. |
addGuest(email) | CalendarEvent | הוספת משתתפים לאירוע. |
addPopupReminder(minutesBefore) | CalendarEvent | הוספת הודעה קופצת חדשה לאירוע. |
addSmsReminder(minutesBefore) | CalendarEvent | הוספת תזכורת SMS חדשה לאירוע. |
anyoneCanAddSelf() | Boolean | ההגדרה קובעת אם אנשים יוכלו להוסיף את עצמם כאורחים לאירוע ביומן. |
deleteEvent() | void | מוחק אירוע ביומן. |
deleteTag(key) | CalendarEvent | מחיקת תג מפתח/ערך מהאירוע. |
getAllDayEndDate() | Date | הפונקציה מקבלת את התאריך שבו האירוע הזה ביומן של יום שלם מסתיים. |
getAllDayStartDate() | Date | הפונקציה מקבלת את התאריך שבו מתחיל האירוע הזה ביומן של יום שלם. |
getAllTagKeys() | String[] | קבלת כל המפתחות לתגים שהוגדרו באירוע. |
getColor() | String | מחזירה את הצבע של האירוע ביומן. |
getCreators() | String[] | מאתר את היוצרים של אירוע. |
getDateCreated() | Date | הפונקציה מקבלת את התאריך שבו האירוע נוצר. |
getDescription() | String | קבלת תיאור האירוע. |
getEmailReminders() | Integer[] | מקבל את ערכי הדקות עבור כל התזכורות באימייל עבור האירוע. |
getEndTime() | Date | הפונקציה מקבלת את התאריך והשעה שבהם האירוע ביומן הזה מסתיים. |
getEventSeries() | CalendarEventSeries | הפונקציה מקבלת את סדרת האירועים החוזרים שהאירוע הזה שייך להם. |
getGuestByEmail(email) | EventGuest | מקבל אורח לפי כתובת אימייל. |
getGuestList() | EventGuest[] | הוספת המשתתפים לאירוע, לא כולל הבעלים. |
getGuestList(includeOwner) | EventGuest[] | מקבל את האורחים לאירוע, כולל הבעלים של האירוע. |
getId() | String | מקבל את ה-iCalUID הייחודי של האירוע. |
getLastUpdated() | Date | הפונקציה מקבלת את התאריך שבו האירוע עודכן לאחרונה. |
getLocation() | String | לקבל את מיקום האירוע. |
getMyStatus() | GuestStatus | קבלת הסטטוס של האירוע (למשל, נוכחות או הזמנה) של המשתמש הרלוונטי. |
getOriginalCalendarId() | String | קבלת המזהה של היומן שבו האירוע הזה נוצר במקור. |
getPopupReminders() | Integer[] | קבלת ערכי הדקות לכל התזכורות הקופצות לאירוע. |
getSmsReminders() | Integer[] | מקבל את ערכי הדקות לכל התזכורות ב-SMS לאירוע. |
getStartTime() | Date | הפונקציה מקבלת את התאריך והשעה שבהם האירוע הזה מתחיל ביומן. |
getTag(key) | String | מקבל ערך תג של האירוע. |
getTitle() | String | הפונקציה מקבלת את שם האירוע. |
getVisibility() | Visibility | מקבל את החשיפה של האירוע. |
guestsCanInviteOthers() | Boolean | קובעת אם אורחים יכולים להזמין אורחים אחרים. |
guestsCanModify() | Boolean | קובעת אם המשתתפים יכולים לשנות את האירוע. |
guestsCanSeeGuests() | Boolean | קובעת אם אורחים יכולים לראות אורחים אחרים. |
isAllDayEvent() | Boolean | ההגדרה הזו קובעת אם האירוע הוא של יום שלם. |
isOwnedByMe() | Boolean | מציין אם אתם הבעלים של האירוע. |
isRecurringEvent() | Boolean | הפונקציה קובעת אם האירוע הוא חלק מסדרה של אירועים. |
removeAllReminders() | CalendarEvent | כל התזכורות יוסרו מהאירוע. |
removeGuest(email) | CalendarEvent | הסרת משתתף מהאירוע. |
resetRemindersToDefault() | CalendarEvent | איפוס התזכורות באמצעות הגדרות ברירת המחדל של היומן. |
setAllDayDate(date) | CalendarEvent | מגדיר את תאריך האירוע. |
setAllDayDates(startDate, endDate) | CalendarEvent | מגדיר את תאריכי האירוע. |
setAnyoneCanAddSelf(anyoneCanAddSelf) | CalendarEvent | ההגדרה קובעת אם משתתפים שאינם משתתפים יכולים להוסיף את עצמם לאירוע. |
setColor(color) | CalendarEvent | מגדיר את הצבע של האירוע ביומן. |
setDescription(description) | CalendarEvent | מגדיר את תיאור האירוע. |
setGuestsCanInviteOthers(guestsCanInviteOthers) | CalendarEvent | ההגדרה קובעת אם אורחים יכולים להזמין אורחים אחרים. |
setGuestsCanModify(guestsCanModify) | CalendarEvent | קובעת אם המשתתפים יכולים לשנות את האירוע. |
setGuestsCanSeeGuests(guestsCanSeeGuests) | CalendarEvent | מגדיר אם אורחים יכולים לראות אורחים אחרים. |
setLocation(location) | CalendarEvent | מגדיר את מיקום האירוע. |
setMyStatus(status) | CalendarEvent | מגדיר את סטטוס האירוע (למשל: נוכח או מוזמן) של המשתמש בפועל. |
setTag(key, value) | CalendarEvent | מגדירה תג מפתח/ערך באירוע, לאחסון מטא-נתונים מותאמים אישית. |
setTime(startTime, endTime) | CalendarEvent | האפשרות הזו מגדירה את התאריכים והשעות לתחילת ולסיום של האירוע. |
setTitle(title) | CalendarEvent | הגדרת שם האירוע. |
setVisibility(visibility) | CalendarEvent | מגדיר את החשיפה של האירוע. |
תיעוד מפורט
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);
פרמטרים
שם | תיאור | התיאור |
---|---|---|
minutesBefore | Integer | מספר הדקות לפני האירוע |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
קליעות
Error
– אם יש יותר מ-5 תזכורות באירוע או שהשעה לא בטווח החוקי
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 let attendeeEmail = 'user@example.com'; // Email address of the person you need to add let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar containing event let eventId = '123abc'; // ID of event instance let calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } let event = calendar.getEventById(eventId); if (event === null) { // Event not found console.log('Event not found', eventId); return; } event.addGuest(attendeeEmail); } // Example 2: Add a guest to all events on a calendar within a specified timeframe function addAttendeeToAllEvents(){ // Replace the following values with your own let attendeeEmail = 'user@example.com'; // Email address of the person you need to add let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar with the events let startDate = new Date("YYYY-MM-DD"); // The first date to add the guest to the events let endDate = new Date("YYYY-MM-DD"); // The last date to add the guest to the events let calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } // Get the events within the specified timeframe let calEvents = calendar.getEvents(startDate,endDate); console.log(calEvents.length); // Checks how many events are found // Loop through all events and add the attendee to each of them for (var i = 0; i < calEvents.length; i++) { let event = calEvents[i]; event.addGuest(attendeeEmail); } }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
email | String | כתובת האימייל של האורח. |
החזרות
CalendarEvent
– CalendarEvent
לשרשור.
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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);
פרמטרים
שם | תיאור | התיאור |
---|---|---|
minutesBefore | Integer | מספר הדקות לפני האירוע |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addSmsReminder(minutesBefore)
הוספת תזכורת SMS חדשה לאירוע. התזכורת צריכה להיות לפחות 5 דקות, ולא יותר מ-4 שבועות (40,320 דקות), לפני האירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
minutesBefore | Integer | מספר הדקות לפני האירוע |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
קליעות
Error
– אם יש יותר מ-5 תזכורות באירוע או שהשעה לא בטווח החוקי
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
אם לא
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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();
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
deleteTag(key)
מחיקת תג מפתח/ערך מהאירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
key | String | מפתח התג |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– תאריך הסיום של האירוע הזה ביומן של כל היום
קליעות
Error
– אם האירוע הזה אינו אירוע של יום שלם
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– תאריך ההתחלה של האירוע הזה ביומן של כל היום
קליעות
Error
– אם האירוע הזה אינו אירוע של יום שלם
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getAllTagKeys()
קבלת כל המפתחות לתגים שהוגדרו באירוע.
החזרות
String[]
– מערך של מפתחות מחרוזת
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
.
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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[]
– כתובות האימייל של יוצרי האירוע
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– תאריך היצירה
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– התיאור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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[]
– מערך שבו כל ערך תואם למספר הדקות לפני האירוע שתזכורת מפעילה
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– שעת הסיום של האירוע הזה ביומן
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– סדרת האירועים שהאירוע הזה שייך אליה, או סדרת אירועים חדשה אם היא עדיין לא שייכת
לסדרה
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 אם כתובת האימייל לא מתאימה לאורח
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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[]
– מערך של האורחים
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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()); }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
includeOwner | Boolean | האם לכלול את הבעלים כאורחים |
החזרות
EventGuest[]
– מערך של האורחים
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getId()
מקבל את ה-iCalUID הייחודי של האירוע. שימו לב שה-iCalUID והאירוע id
שמשמשים את יומן v3 API ואת השירות המתקדם של יומן Google אינם זהים ואי אפשר להשתמש לסירוגין ביניהם. אחד ההבדלים בסמנטיקה שלהן הוא שבאירועים חוזרים, לכל המופעים של אירוע אחד יש 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 של האירוע
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– תאריך העדכון האחרון
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– מיקום האירוע
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– הסטטוס
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– המזהה של היומן המקורי
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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[]
– מערך שבו כל ערך תואם למספר הדקות לפני האירוע שתזכורת מפעילה
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getSmsReminders()
מקבל את ערכי הדקות לכל התזכורות ב-SMS לאירוע.
החזרות
Integer[]
– מערך שבו כל ערך תואם למספר הדקות לפני האירוע שתזכורת מפעילה
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– שעת ההתחלה של האירוע הזה ביומן
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
- ערך התג
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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@google.com'); // and replace the series ID with your own. const event = calendar.getEvents(new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'))[0]; if (event) { // If an event exists within the given time frame, logs the title of the event. console.log(event.getTitle()); } else { // If no event exists within the given time frame, logs that information to the console. console.log('No events exist for the specified range'); }
החזרות
String
– הכותרת
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
– ערך החשיפה
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
אם לא
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
אם לא
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
אם לא
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 let attendeeEmail = 'user@example.com'; // Email address of the person you need to remove let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar containing event let eventId = '123abc'; // ID of event instance let calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } let event = calendar.getEventById(eventId); if (event === null) { // Event not found console.log('Event not found', eventId); return; } event.removeGuest(attendeeEmail); } // Example 2: Remove a guest from all events on a calendar within a specified timeframe function removeGuestFromAllEvents(){ // Replace the following values with your own let attendeeEmail = 'user@example.com'; // Email address of the person you need to remove let calendarId = 'calendar_123@group.calendar.google.com'; // ID of calendar with the events let startDate = new Date("YYYY-MM-DD"); // The first date to remove the guest from the events let endDate = new Date("YYYY-MM-DD"); // The last date to remove the attendee from the events let calendar = CalendarApp.getCalendarById(calendarId); if (calendar === null) { // Calendar not found console.log('Calendar not found', calendarId); return; } // Get the events within the specified timeframe let calEvents = calendar.getEvents(startDate,endDate); console.log(calEvents.length); // Checks how many events are found // Loop through all events and remove the attendee from each of them for (var i = 0; i < calEvents.length; i++) { let event = calEvents[i]; event.removeGuest(attendeeEmail); } }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
email | String | כתובת האימייל של האורח |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 הזה לשרשורים
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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'); }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
startDate | Date | התאריך שבו האירוע מתחיל (המערכת מתעלמת מהשעה) |
endDate | Date | התאריך שבו האירוע מסתיים (המערכת מתעלמת מהשעה) |
החזרות
CalendarEvent
– ה-calendarEvent הזה לשרשורים
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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'); }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
anyoneCanAddSelf | Boolean | אם מישהו יכול להזמין את עצמו |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | אינדקס צבע של מספר שלם כמחרוזת, או ערך מ-CalendarApp.EventColor . |
החזרות
CalendarEvent
– האירוע הזה ביומן, לשרשור.
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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'); }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
guestsCanInviteOthers | Boolean | האם אורחים יכולים להזמין אחרים |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanModify(guestsCanModify)
קובעת אם המשתתפים יכולים לשנות את האירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
guestsCanModify | Boolean | האם אורחים יכולים לשנות את האירוע |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanSeeGuests(guestsCanSeeGuests)
מגדיר אם אורחים יכולים לראות אורחים אחרים.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
guestsCanSeeGuests | Boolean | האם אורחים יכולים לראות אחרים |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | GuestStatus | הסטטוס החדש |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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);
פרמטרים
שם | תיאור | התיאור |
---|---|---|
startTime | Date | ההתחלה החדשה של האירוע |
endTime | Date | הסוף החדש של האירוע |
החזרות
CalendarEvent
– ה-calendarEvent הזה לשרשורים
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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@google.com'); // and replace the series ID with your own. const event = calendar.getEvents(new Date('Jan 31, 2023 09:05:00'), new Date('Jan 31, 2023 09:15:00'))[0]; if (event) { // If an event exists within the given time frame, changes its title to Event1. event.setTitle('Event1'); } else { // If no event exists within the given time frame, logs that information to the console. console.log('No events exist for the specified range'); }
פרמטרים
שם | תיאור | התיאור |
---|---|---|
title | String | השם החדש |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setVisibility(visibility)
מגדיר את החשיפה של האירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
visibility | Visibility |
החזרות
CalendarEvent
– CalendarEvent
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds