סדרה של אירועים (אירוע חוזר).
שיטות
שיטה | סוג הערך שמוחזר | תיאור קצר |
---|---|---|
addEmailReminder(minutesBefore) | CalendarEventSeries | הוספת תזכורת חדשה באימייל לאירוע. |
addGuest(email) | CalendarEventSeries | הוספת משתתפים לאירוע. |
addPopupReminder(minutesBefore) | CalendarEventSeries | הוספת הודעה קופצת חדשה לאירוע. |
addSmsReminder(minutesBefore) | CalendarEventSeries | הוספת תזכורת SMS חדשה לאירוע. |
anyoneCanAddSelf() | Boolean | ההגדרה קובעת אם אנשים יוכלו להוסיף את עצמם כאורחים לאירוע ביומן. |
deleteEventSeries() | void | מוחק את סדרת האירועים. |
deleteTag(key) | CalendarEventSeries | מחיקת תג מפתח/ערך מהאירוע. |
getAllTagKeys() | String[] | קבלת כל המפתחות לתגים שהוגדרו באירוע. |
getColor() | String | מחזירה את הצבע של האירוע ביומן. |
getCreators() | String[] | מאתר את היוצרים של אירוע. |
getDateCreated() | Date | הפונקציה מקבלת את התאריך שבו האירוע נוצר. |
getDescription() | String | קבלת תיאור האירוע. |
getEmailReminders() | Integer[] | מקבל את ערכי הדקות עבור כל התזכורות באימייל עבור האירוע. |
getGuestByEmail(email) | EventGuest | מקבל אורח לפי כתובת אימייל. |
getGuestList() | EventGuest[] | הוספת המשתתפים לאירוע, לא כולל הבעלים. |
getGuestList(includeOwner) | EventGuest[] | מקבל את האורחים לאירוע, כולל הבעלים של האירוע. |
getId() | String | מקבל את ה-iCalUID הייחודי של האירוע. |
getLastUpdated() | Date | הפונקציה מקבלת את התאריך שבו האירוע עודכן לאחרונה. |
getLocation() | String | לקבל את מיקום האירוע. |
getMyStatus() | GuestStatus | קבלת הסטטוס של האירוע (למשל, נוכחות או הזמנה) של המשתמש הרלוונטי. |
getOriginalCalendarId() | String | קבלת המזהה של היומן שבו האירוע הזה נוצר במקור. |
getPopupReminders() | Integer[] | קבלת ערכי הדקות לכל התזכורות הקופצות לאירוע. |
getSmsReminders() | Integer[] | מקבל את ערכי הדקות לכל התזכורות ב-SMS לאירוע. |
getTag(key) | String | מקבל ערך תג של האירוע. |
getTitle() | String | הפונקציה מקבלת את שם האירוע. |
getVisibility() | Visibility | מקבל את החשיפה של האירוע. |
guestsCanInviteOthers() | Boolean | קובעת אם אורחים יכולים להזמין אורחים אחרים. |
guestsCanModify() | Boolean | קובעת אם המשתתפים יכולים לשנות את האירוע. |
guestsCanSeeGuests() | Boolean | קובעת אם אורחים יכולים לראות אורחים אחרים. |
isOwnedByMe() | Boolean | מציין אם אתם הבעלים של האירוע. |
removeAllReminders() | CalendarEventSeries | כל התזכורות יוסרו מהאירוע. |
removeGuest(email) | CalendarEventSeries | הסרת משתתף מהאירוע. |
resetRemindersToDefault() | CalendarEventSeries | איפוס התזכורות באמצעות הגדרות ברירת המחדל של היומן. |
setAnyoneCanAddSelf(anyoneCanAddSelf) | CalendarEventSeries | ההגדרה קובעת אם משתתפים שאינם משתתפים יכולים להוסיף את עצמם לאירוע. |
setColor(color) | CalendarEventSeries | מגדיר את הצבע של האירוע ביומן. |
setDescription(description) | CalendarEventSeries | מגדיר את תיאור האירוע. |
setGuestsCanInviteOthers(guestsCanInviteOthers) | CalendarEventSeries | ההגדרה קובעת אם אורחים יכולים להזמין אורחים אחרים. |
setGuestsCanModify(guestsCanModify) | CalendarEventSeries | קובעת אם המשתתפים יכולים לשנות את האירוע. |
setGuestsCanSeeGuests(guestsCanSeeGuests) | CalendarEventSeries | מגדיר אם אורחים יכולים לראות אורחים אחרים. |
setLocation(location) | CalendarEventSeries | מגדיר את מיקום האירוע. |
setMyStatus(status) | CalendarEventSeries | מגדיר את סטטוס האירוע (למשל: נוכח או מוזמן) של המשתמש בפועל. |
setRecurrence(recurrence, startDate) | CalendarEventSeries | מגדיר את כללי החזרה לסדרת אירועים של יום שלם. |
setRecurrence(recurrence, startTime, endTime) | CalendarEventSeries | מגדיר את כללי החזרה עבור סדרת האירועים הזו. |
setTag(key, value) | CalendarEventSeries | מגדירה תג מפתח/ערך באירוע, לאחסון מטא-נתונים מותאמים אישית. |
setTitle(title) | CalendarEventSeries | הגדרת שם האירוע. |
setVisibility(visibility) | CalendarEventSeries | מגדיר את החשיפה של האירוע. |
תיעוד מפורט
addEmailReminder(minutesBefore)
הוספת תזכורת חדשה באימייל לאירוע. התזכורת צריכה להיות לפחות 5 דקות, ולא יותר מ-4 שבועות (40,320 דקות), לפני האירוע.
// Gets an event by its ID. For an event series, use getEventSeriesById(iCalId) instead. // TODO(developer): Replace the string with the event ID that you want to get. const event = CalendarApp.getEventById('abc123456'); // Adds an email notification for 15 minutes before the event. event.addEmailReminder(15);
פרמטרים
שם | תיאור | התיאור |
---|---|---|
minutesBefore | Integer | מספר הדקות לפני האירוע |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
קליעות
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 | כתובת האימייל של האורח. |
החזרות
CalendarEventSeries
– CalendarEventSeries
לשרשור.
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | מספר הדקות לפני האירוע |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addSmsReminder(minutesBefore)
הוספת תזכורת SMS חדשה לאירוע. התזכורת צריכה להיות לפחות 5 דקות, ולא יותר מ-4 שבועות (40,320 דקות), לפני האירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
minutesBefore | Integer | מספר הדקות לפני האירוע |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
קליעות
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
deleteEventSeries()
מוחק את סדרת האירועים.
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
deleteTag(key)
מחיקת תג מפתח/ערך מהאירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
key | String | מפתח התג |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
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
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
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
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
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'); }
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | כתובת האימייל של האורח |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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'); }
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | אם מישהו יכול להזמין את עצמו |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 . |
החזרות
CalendarEventSeries
– האירוע הזה ביומן, לשרשור.
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | התיאור החדש |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | האם אורחים יכולים להזמין אחרים |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanModify(guestsCanModify)
קובעת אם המשתתפים יכולים לשנות את האירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
guestsCanModify | Boolean | האם אורחים יכולים לשנות את האירוע |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanSeeGuests(guestsCanSeeGuests)
מגדיר אם אורחים יכולים לראות אורחים אחרים.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
guestsCanSeeGuests | Boolean | האם אורחים יכולים לראות אחרים |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | המיקום החדש |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | הסטטוס החדש |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
setRecurrence(recurrence, startDate)
מגדיר את כללי החזרה לסדרת אירועים של יום שלם. ההחלה של השיטה הזו הופכת סדרת אירועים רגילה לסדרת אירועים של יום שלם.
// Sets the events in a series to take place every Wednesday in 2013. var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com'); var startDate = new Date('January 2, 2013 03:00:00 PM EST'); var recurrence = CalendarApp.newRecurrence().addWeeklyRule() .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY) .until(new Date('January 1, 2014')); eventSeries.setRecurrence(recurrence, startDate);
פרמטרים
שם | תיאור | התיאור |
---|---|---|
recurrence | EventRecurrence | את כללי החזרה שבהם צריך להשתמש |
startDate | Date | התאריך של האירוע הראשון בסדרה (נעשה שימוש רק באותו היום, המערכת מתעלמת מהשעה) |
החזרות
CalendarEventSeries
– CalendarEventSeries הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setRecurrence(recurrence, startTime, endTime)
מגדיר את כללי החזרה עבור סדרת האירועים הזו. ההחלה של השיטה הזו הופכת סדרה של אירועים של יום שלם לסדרת אירועים רגילה.
// Sets the events in a series to take place from 3pm to 4pm every Tuesday and Thursday in // 2013. var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com'); var startTime = new Date('January 1, 2013 03:00:00 PM EST'); var endTime = new Date('January 1, 2013 04:00:00 PM EST'); var recurrence = CalendarApp.newRecurrence().addWeeklyRule() .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY]) .until(new Date('January 1, 2014')); eventSeries.setRecurrence(recurrence, startTime, endTime);
פרמטרים
שם | תיאור | התיאור |
---|---|---|
recurrence | EventRecurrence | את כללי החזרה שבהם צריך להשתמש |
startTime | Date | התאריך והשעה שבהם מתחיל האירוע הראשון בסדרה |
endTime | Date | התאריך והשעה שבהם האירוע הראשון בסדרה מסתיים |
החזרות
CalendarEventSeries
– CalendarEventSeries הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setTag(key, value)
מגדירה תג מפתח/ערך באירוע, לאחסון מטא-נתונים מותאמים אישית.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
key | String | מפתח התג |
value | String | ערך התג |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-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 | השם החדש |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setVisibility(visibility)
מגדיר את החשיפה של האירוע.
פרמטרים
שם | תיאור | התיאור |
---|---|---|
visibility | Visibility |
החזרות
CalendarEventSeries
– CalendarEventSeries
הזה לשרשור
הרשאות
לסקריפטים שמשתמשים בשיטה הזו נדרשת הרשאה עם אחד או יותר מההיקפים הבאים או עם ההיקפים המתאימים מ-API ל-REST הקשור:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds