Class CalendarEvent

تقویمرویداد

یک رویداد تقویمی واحد را نشان می‌دهد.

روش‌ها

روش نوع بازگشتی شرح مختصر
add Email Reminder(minutesBefore) Calendar Event یک یادآوری ایمیل جدید به رویداد اضافه می‌کند.
add Guest(email) Calendar Event یک مهمان به رویداد اضافه می‌کند.
add Popup Reminder(minutesBefore) Calendar Event یک اعلان پاپ‌آپ جدید به رویداد اضافه می‌کند.
add Sms Reminder(minutesBefore) Calendar Event یک یادآوری پیامکی جدید به رویداد اضافه می‌کند.
anyone Can Add Self() Boolean تعیین می‌کند که آیا افراد می‌توانند خود را به عنوان مهمان به یک رویداد تقویم اضافه کنند یا خیر.
delete Event() void یک رویداد تقویم را حذف می‌کند.
delete Tag(key) Calendar Event یک برچسب کلید/مقدار را از رویداد حذف می‌کند.
get All Day End Date() Date تاریخی را که این رویداد تقویمی تمام روز در آن پایان می‌یابد، دریافت می‌کند.
get All Day Start Date() Date تاریخی را که این رویداد تقویمی تمام روز از آن شروع می‌شود، دریافت می‌کند.
get All Tag Keys() String[] تمام کلیدهای مربوط به تگ‌هایی که روی رویداد تنظیم شده‌اند را دریافت می‌کند.
get Color() String رنگ رویداد تقویم را برمی‌گرداند.
get Creators() String[] سازندگان یک رویداد را پیدا می‌کند.
get Date Created() Date تاریخ ایجاد رویداد را دریافت می‌کند.
get Description() String شرح رویداد را دریافت می‌کند.
get Email Reminders() Integer[] مقادیر دقیقه را برای همه یادآوری‌های ایمیلی مربوط به رویداد دریافت می‌کند.
get End Time() Date تاریخ و زمانی را که این رویداد تقویمی در آن پایان می‌یابد، دریافت می‌کند.
get Event Series() Calendar Event Series مجموعه رویدادهای تکرارشونده‌ای را که این رویداد به آنها تعلق دارد، دریافت می‌کند.
get Event Type() Event Type Event Type این رویداد را دریافت می‌کند.
get Guest By Email(email) Event Guest از طریق آدرس ایمیل مهمان دریافت می‌کند.
get Guest List() Event Guest[] مهمانان رویداد را انتخاب می‌کند، به جز صاحب رویداد.
get Guest List(includeOwner) Event Guest[] مهمانان رویداد، از جمله صاحبان رویداد، را انتخاب می‌کند.
get Id() String iCalUID منحصر به فرد رویداد را دریافت می‌کند.
get Last Updated() Date تاریخ آخرین به‌روزرسانی رویداد را دریافت می‌کند.
get Location() String مکان رویداد را دریافت می‌کند.
get My Status() Guest Status وضعیت رویداد (مانند شرکت‌کننده یا دعوت‌شده) کاربر مؤثر را دریافت می‌کند.
get Original Calendar Id() String شناسه تقویمی را که این رویداد در ابتدا در آن ایجاد شده است، دریافت کنید.
get Popup Reminders() Integer[] مقادیر دقیقه را برای همه یادآوری‌های پاپ‌آپ برای رویداد دریافت می‌کند.
get Sms Reminders() Integer[] مقادیر دقیقه را برای همه یادآوری‌های پیامکی مربوط به رویداد دریافت می‌کند.
get Start Time() Date تاریخ و زمانی را که این رویداد تقویمی از آن شروع می‌شود، دریافت می‌کند.
get Tag(key) String مقدار برچسب رویداد را دریافت می‌کند.
get Title() String عنوان رویداد را به خود اختصاص می‌دهد.
get Transparency() Event Transparency شفافیت رویداد را به دست می‌آورد.
get Visibility() Visibility قابلیت مشاهده رویداد را پیدا می‌کند.
guests Can Invite Others() Boolean مشخص می‌کند که آیا مهمانان می‌توانند مهمانان دیگری را دعوت کنند یا خیر.
guests Can Modify() Boolean تعیین می‌کند که آیا مهمانان می‌توانند رویداد را تغییر دهند یا خیر.
guests Can See Guests() Boolean تعیین می‌کند که آیا مهمانان می‌توانند مهمانان دیگر را ببینند یا خیر.
is All Day Event() Boolean مشخص می‌کند که آیا این رویداد تمام روز است یا خیر.
is Owned By Me() Boolean مشخص می‌کند که آیا شما مالک رویداد هستید یا خیر.
is Recurring Event() Boolean مشخص می‌کند که آیا رویداد بخشی از یک سری رویداد است یا خیر.
remove All Reminders() Calendar Event تمام یادآوری‌های رویداد را حذف می‌کند.
remove Guest(email) Calendar Event مهمان را از رویداد حذف می‌کند.
reset Reminders To Default() Calendar Event یادآوری‌ها را با استفاده از تنظیمات پیش‌فرض تقویم، مجدداً تنظیم می‌کند.
set All Day Date(date) Calendar Event تاریخ رویداد را تعیین می‌کند.
set All Day Dates(startDate, endDate) Calendar Event تاریخ‌های رویداد را تعیین می‌کند.
set Anyone Can Add Self(anyoneCanAddSelf) Calendar Event تعیین می‌کند که آیا افراد غیر مهمان می‌توانند خود را به رویداد اضافه کنند یا خیر.
set Color(color) Calendar Event رنگ رویداد تقویم را تنظیم می‌کند.
set Description(description) Calendar Event شرح رویداد را تنظیم می‌کند.
set Guests Can Invite Others(guestsCanInviteOthers) Calendar Event تنظیم می‌کند که آیا مهمانان می‌توانند مهمانان دیگر را دعوت کنند یا خیر.
set Guests Can Modify(guestsCanModify) Calendar Event تعیین می‌کند که آیا مهمانان می‌توانند رویداد را تغییر دهند یا خیر.
set Guests Can See Guests(guestsCanSeeGuests) Calendar Event تنظیم می‌کند که آیا مهمانان می‌توانند مهمانان دیگر را ببینند یا خیر.
set Location(location) Calendar Event مکان رویداد را تعیین می‌کند.
set My Status(status) Calendar Event وضعیت رویداد (مانند شرکت کردن یا دعوت شدن) کاربر مؤثر را تنظیم می‌کند.
set Tag(key, value) Calendar Event یک برچسب کلید/مقدار برای رویداد، برای ذخیره ابرداده‌های سفارشی، تنظیم می‌کند.
set Time(startTime, endTime) Calendar Event تاریخ و زمان شروع و پایان رویداد را تعیین می‌کند.
set Title(title) Calendar Event عنوان رویداد را تنظیم می‌کند.
set Transparency(transparency) Calendar Event شفافیت رویداد را تنظیم می‌کند.
set Visibility(visibility) Calendar Event میزان دیده شدن رویداد را تنظیم می‌کند.

مستندات دقیق

addEmailReminder(minutesBefore)

یک یادآوری ایمیل جدید به رویداد اضافه می‌کند. یادآوری باید حداقل ۵ دقیقه و حداکثر ۴ هفته (۴۰۳۲۰ دقیقه) قبل از رویداد باشد.

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

// Adds an email notification for 15 minutes before the event.
event.addEmailReminder(15);

پارامترها

نام نوع توضیحات
minutes Before Integer تعداد دقایق قبل از رویداد

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

پرتاب‌ها

Error — اگر بیش از ۵ یادآوری برای رویداد وجود داشته باشد یا زمان در محدوده قانونی نباشد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

addGuest(email)

یک مهمان به رویداد اضافه می‌کند.

// Example 1: Add a guest to one event
function addAttendeeToEvent() {
  // Replace the below values with your own
  const attendeeEmail =
      'user@example.com';  // Email address of the person you need to add
  const calendarId =
      'calendar_123@group.calendar.google.com';  // ID of calendar containing
  // event
  const eventId = '123abc';  // ID of event instance

  const calendar = CalendarApp.getCalendarById(calendarId);
  if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
  }
  const event = calendar.getEventById(eventId);
  if (event === null) {
    // Event not found
    console.log('Event not found', eventId);
    return;
  }
  event.addGuest(attendeeEmail);
}

// Example 2: Add a guest to all events on a calendar within a specified
// timeframe
function addAttendeeToAllEvents() {
  // Replace the following values with your own
  const attendeeEmail =
      'user@example.com';  // Email address of the person you need to add
  const calendarId =
      'calendar_123@group.calendar.google.com';  // ID of calendar with the
  // events
  const startDate =
      new Date('YYYY-MM-DD');  // The first date to add the guest to the events
  const endDate =
      new Date('YYYY-MM-DD');  // The last date to add the guest to the events

  const calendar = CalendarApp.getCalendarById(calendarId);
  if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
  }
  // Get the events within the specified timeframe
  const calEvents = calendar.getEvents(startDate, endDate);
  console.log(calEvents.length);  // Checks how many events are found
  // Loop through all events and add the attendee to each of them
  for (let i = 0; i < calEvents.length; i++) {
    const event = calEvents[i];
    event.addGuest(attendeeEmail);
  }
}

پارامترها

نام نوع توضیحات
email String آدرس ایمیل مهمان.

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

addPopupReminder(minutesBefore)

یک اعلان پاپ‌آپ جدید به رویداد اضافه می‌کند. این اعلان باید حداقل ۵ دقیقه و حداکثر ۴ هفته (۴۰۳۲۰ دقیقه) قبل از رویداد باشد.

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

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

پارامترها

نام نوع توضیحات
minutes Before Integer تعداد دقایق قبل از رویداد

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

addSmsReminder(minutesBefore)

یک یادآوری پیامکی جدید به رویداد اضافه می‌کند. یادآوری باید حداقل ۵ دقیقه و حداکثر ۴ هفته (۴۰۳۲۰ دقیقه) قبل از رویداد باشد.

پارامترها

نام نوع توضیحات
minutes Before Integer تعداد دقایق قبل از رویداد

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

پرتاب‌ها

Error — اگر بیش از ۵ یادآوری برای رویداد وجود داشته باشد یا زمان در محدوده قانونی نباشد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برمی‌گرداند.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

deleteTag(key)

یک برچسب کلید/مقدار را از رویداد حذف می‌کند.

پارامترها

نام نوع توضیحات
key String کلید برچسب

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — اگر این رویداد یک رویداد تمام روز نباشد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — اگر این رویداد یک رویداد تمام روز نباشد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getAllTagKeys()

تمام کلیدهای مربوط به تگ‌هایی که روی رویداد تنظیم شده‌اند را دریافت می‌کند.

بازگشت

String[] — آرایه‌ای از کلیدهای رشته‌ای

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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[] — آدرس‌های ایمیل سازندگان رویداد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 - تاریخ ایجاد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 - توضیحات

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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[] - آرایه‌ای که در آن هر مقدار مربوط به تعداد دقایق قبل از رویدادی است که یادآوری آن را فعال می‌کند.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — زمان پایان این رویداد تقویمی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — مجموعه رویدادهایی که این رویداد به آنها تعلق دارد، یا اگر هنوز به مجموعه ای تعلق ندارد، یک مجموعه رویداد جدید.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getEventType()

EventType این رویداد را دریافت می‌کند.

// Opens the default calendar and logs all out-of-office events for the current day.
const calendar = CalendarApp.getDefaultCalendar();
const events = calendar.getEventsForDay(new Date());
console.log(events.filter(e => e.getEventType() === CalendarApp.EventType.OUT_OF_OFFICE));

بازگشت

EventType — نوع رویداد.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 است.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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[] — آرایه‌ای از مهمان‌ها

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getGuestList(includeOwner)

مهمانان رویداد، از جمله صاحبان رویداد، را انتخاب می‌کند.

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

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

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

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

پارامترها

نام نوع توضیحات
include Owner Boolean اینکه آیا مالکان را به عنوان مهمان در نظر بگیریم یا خیر

بازگشت

EventGuest[] — آرایه‌ای از مهمان‌ها

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getId()

iCalUID منحصر به فرد رویداد را دریافت می‌کند. توجه داشته باشید که iCalUID و id رویداد مورد استفاده توسط API تقویم نسخه ۳ و سرویس پیشرفته تقویم یکسان نیستند و نمی‌توان آنها را به جای یکدیگر استفاده کرد. یک تفاوت در معنای آنها این است که در رویدادهای تکرارشونده، همه رویدادهای یک رویداد 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 رویداد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — آخرین تاریخ به‌روزرسانی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 - مکان رویداد

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — وضعیت

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 - شناسه تقویم اصلی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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[] - آرایه‌ای که در آن هر مقدار مربوط به تعداد دقایق قبل از رویدادی است که یادآوری آن را فعال می‌کند.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getSmsReminders()

مقادیر دقیقه را برای همه یادآوری‌های پیامکی مربوط به رویداد دریافت می‌کند.

بازگشت

Integer[] - آرایه‌ای که در آن هر مقدار مربوط به تعداد دقایق قبل از رویدادی است که یادآوری آن را فعال می‌کند.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 — زمان شروع این رویداد تقویمی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getTag(key)

مقدار برچسب رویداد را دریافت می‌کند.

پارامترها

نام نوع توضیحات
key String کلید

بازگشت

String - مقدار برچسب

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getTitle()

عنوان رویداد را به خود اختصاص می‌دهد.

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

// Gets the first event from the calendar for January 31st, 2023 that takes
// place between 9:05 AM and 9:15 AM. For an event series, use
// calendar.getEventSeriesById('abc123456@example.com'); and replace the series
// ID with your own.
const event = calendar.getEvents(
    new Date('Jan 31, 2023 09:05:00'),
    new Date('Jan 31, 2023 09:15:00'),
    )[0];

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

بازگشت

String - عنوان

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

getTransparency()

میزان شفافیت رویداد را دریافت می‌کند. از این متد برای تعیین اینکه آیا یک رویداد TRANSPARENT است، به این معنی که تقویم در آن زمان به صورت Available (موجود) نشان داده می‌شود، یا OPAQUE ، به این معنی که تقویم در آن زمان به صورت Busy (مشغول) نشان داده می‌شود، استفاده کنید.

// Gets the first event from the default calendar for today.
const today = new Date();
const event = CalendarApp.getDefaultCalendar().getEventsForDay(today)[0];
// Gets the event's transparency and logs it.
const transparency = event.getTransparency();
Logger.log(transparency);

بازگشت

EventTransparency - مقدار شفافیت.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 - مقدار قابلیت مشاهده

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برمی‌گرداند.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برمی‌گرداند.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

removeGuest(email)

مهمان را از رویداد حذف می‌کند.

// Example 1: Remove a guest from one event
function removeGuestFromEvent() {
  // Replace the below values with your own
  const attendeeEmail =
      'user@example.com';  // Email address of the person you need to remove
  const calendarId =
      'calendar_123@group.calendar.google.com';  // ID of calendar containing
  // event
  const eventId = '123abc';  // ID of event instance

  const calendar = CalendarApp.getCalendarById(calendarId);
  if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
  }
  const event = calendar.getEventById(eventId);
  if (event === null) {
    // Event not found
    console.log('Event not found', eventId);
    return;
  }
  event.removeGuest(attendeeEmail);
}

// Example 2: Remove a guest from all events on a calendar within a specified
// timeframe
function removeGuestFromAllEvents() {
  // Replace the following values with your own
  const attendeeEmail =
      'user@example.com';  // Email address of the person you need to remove
  const calendarId =
      'calendar_123@group.calendar.google.com';  // ID of calendar with the
  // events
  const startDate = new Date(
      'YYYY-MM-DD');  // The first date to remove the guest from the events
  const endDate = new Date(
      'YYYY-MM-DD');  // The last date to remove the attendee from the events

  const calendar = CalendarApp.getCalendarById(calendarId);
  if (calendar === null) {
    // Calendar not found
    console.log('Calendar not found', calendarId);
    return;
  }
  // Get the events within the specified timeframe
  const calEvents = calendar.getEvents(startDate, endDate);
  console.log(calEvents.length);  // Checks how many events are found
  // Loop through all events and remove the attendee from each of them
  for (let i = 0; i < calEvents.length; i++) {
    const event = calEvents[i];
    event.removeGuest(attendeeEmail);
  }
}

پارامترها

نام نوع توضیحات
email String آدرس ایمیل مهمان

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setAllDayDates(startDate, endDate)

تاریخ‌های رویداد را تنظیم می‌کند. اعمال این روش، یک رویداد معمولی را به یک رویداد تمام روز تبدیل می‌کند.

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

// Gets the first event from the calendar for February 18th, 2023 that takes
// place between 4:00 PM and 5:00 PM.
const event = calendar.getEvents(
    new Date('Feb 18, 2023 16:00:00'),
    new Date('Feb 18, 2023 17:00:00'),
    )[0];

if (event) {
  // If an event exists within the given time frame, sets the event to be an
  // all-day event from Feb 18th, 2023 until Feb 25th, 2023. Applying this
  // method changes a regular event into an all-day event.
  event.setAllDayDates(new Date('Feb 18, 2023'), new Date('Feb 25, 2023'));
} else {
  // If no event exists within the given time frame, logs that information to
  // the console.
  console.log('No events exist for the specified range');
}

پارامترها

نام نوع توضیحات
start Date Date تاریخ شروع رویداد (زمان نادیده گرفته می‌شود)
end Date Date تاریخ پایان رویداد (زمان نادیده گرفته می‌شود)

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setAnyoneCanAddSelf(anyoneCanAddSelf)

تعیین می‌کند که آیا افراد غیر مهمان می‌توانند خود را به رویداد اضافه کنند یا خیر.

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

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

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

پارامترها

نام نوع توضیحات
anyone Can Add Self Boolean آیا کسی می‌تواند خودش را دعوت کند؟

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setColor(color)

رنگ رویداد تقویم را تنظیم می‌کند.

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

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

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

پارامترها

نام نوع توضیحات
color String یک اندیس رنگ عدد صحیح به عنوان یک رشته، یا یک مقدار از Calendar App.EventColor .

بازگشت

CalendarEvent — این رویداد تقویم، برای زنجیره‌سازی.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setGuestsCanInviteOthers(guestsCanInviteOthers)

تنظیم می‌کند که آیا مهمانان می‌توانند مهمانان دیگر را دعوت کنند یا خیر.

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

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

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

پارامترها

نام نوع توضیحات
guests Can Invite Others Boolean آیا مهمانان می‌توانند دیگران را دعوت کنند؟

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setGuestsCanModify(guestsCanModify)

تعیین می‌کند که آیا مهمانان می‌توانند رویداد را تغییر دهند یا خیر.

پارامترها

نام نوع توضیحات
guests Can Modify Boolean آیا مهمانان می‌توانند رویداد را تغییر دهند؟

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setGuestsCanSeeGuests(guestsCanSeeGuests)

تنظیم می‌کند که آیا مهمانان می‌توانند مهمانان دیگر را ببینند یا خیر.

پارامترها

نام نوع توضیحات
guests Can See Guests Boolean آیا مهمانان می‌توانند دیگران را ببینند؟

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setMyStatus(status)

وضعیت رویداد (مانند شرکت کردن یا دعوت شدن) کاربر مؤثر را تنظیم می‌کند.

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

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

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

پارامترها

نام نوع توضیحات
status Guest Status وضعیت جدید

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

  • 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 برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setTime(startTime, endTime)

تاریخ و زمان شروع و پایان رویداد را تنظیم می‌کند. اعمال این روش، یک رویداد تمام روز را به یک رویداد معمولی تبدیل می‌کند.

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

// Declares a start time of 11:00 AM on February 20th, 2023 and an end time of
// 12:00 PM on February 20th, 2023.
const startTime = new Date('Feb 20,2023 11:00:00');
const endTime = new Date('Feb 20, 2023  12:00:00');

// Creates an all-day event on February 20th, 2023.
const event = calendar.createAllDayEvent('Meeting', new Date('Feb 20,2023'));

// Updates the all-day event to a regular event by setting a start and end time
// for the event.
event.setTime(startTime, endTime);

پارامترها

نام نوع توضیحات
start Time Date شروع جدید رویداد
end Time Date پایان جدید رویداد

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setTitle(title)

عنوان رویداد را تنظیم می‌کند.

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

// Gets the first event from the calendar for January 31st, 2023 that takes
// place between 9:05 AM and 9:15 AM. For an event series, use
// calendar.getEventSeriesById('abc123456@example.com'); and replace the series
// ID with your own.
const event = calendar.getEvents(
    new Date('Jan 31, 2023 09:05:00'),
    new Date('Jan 31, 2023 09:15:00'),
    )[0];

if (event) {
  // If an event exists within the given time frame, changes its title to
  // Event1.
  event.setTitle('Event1');
} else {
  // If no event exists within the given time frame, logs that information to
  // the console.
  console.log('No events exist for the specified range');
}

پارامترها

نام نوع توضیحات
title String عنوان جدید

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setTransparency(transparency)

شفافیت رویداد را تنظیم می‌کند. از این متد برای تنظیم اینکه آیا یک رویداد TRANSPARENT باشد، به این معنی که تقویم در آن زمان به صورت Available (موجود) نشان داده شود، یا OPAQUE ، به این معنی که تقویم در آن زمان به صورت Busy (مشغول) نشان داده شود، استفاده کنید.

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

پارامترها

نام نوع توضیحات
transparency Event Transparency ارزش شفافیت.

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی.

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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

setVisibility(visibility)

میزان دیده شدن رویداد را تنظیم می‌کند.

پارامترها

نام نوع توضیحات
visibility Visibility

بازگشت

CalendarEvent — این CalendarEvent برای زنجیره‌سازی

مجوز

اسکریپت‌هایی که از این روش استفاده می‌کنند، نیاز به مجوز با یک یا چند مورد از حوزه‌های زیر یا حوزه‌های مناسب از REST API مرتبط دارند:

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