1 つのカレンダーの予定を表します。
Methods
詳細なドキュメント
addEmailReminder(minutesBefore)
予定に新しいメール通知を追加します。リマインダーは、イベントの 5 分~ 4 週間(40,320 分)前までに設定してください。
パラメータ
Name | 型 | 説明 |
---|---|---|
minutesBefore | Integer | イベント前の分数 |
復路
CalendarEvent
- チェーン向けの CalendarEvent
例外
Error
- 予定に 5 件を超えるリマインダーがある場合、または時間が許容範囲内でない場合。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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 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); } }
パラメータ
Name | 型 | 説明 |
---|---|---|
email | String | ゲストのメールアドレス。 |
復路
CalendarEvent
- チェーン用の CalendarEvent
。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addPopupReminder(minutesBefore)
予定に新しいポップアップ リマインダーが追加されます。リマインダーは、イベントの 5 分~ 4 週間(40,320 分)前までに設定してください。
パラメータ
Name | 型 | 説明 |
---|---|---|
minutesBefore | Integer | イベント前の分数 |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addSmsReminder(minutesBefore)
予定に新しい SMS リマインダーが追加されます。リマインダーは、イベントの 5 分~ 4 週間(40,320 分)前までに設定してください。
パラメータ
Name | 型 | 説明 |
---|---|---|
minutesBefore | Integer | イベント前の分数 |
復路
CalendarEvent
- チェーン向けの CalendarEvent
例外
Error
- 予定に 5 件を超えるリマインダーがある場合、または時間が許容範囲内でない場合。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
anyoneCanAddSelf()
自分自身を招待できるかどうかを指定します。
復路
Boolean
- ゲスト以外のユーザーが予定に追加できる場合は true
、そうでない場合は false
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
deleteEvent()
予定を削除します。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
deleteTag(key)
イベントから Key-Value タグを削除します。
パラメータ
Name | 型 | 説明 |
---|---|---|
key | String | タグキー |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
getAllDayEndDate()
この終日のカレンダーの予定の終了日を取得します。(これが終日イベントでない場合、このメソッドは例外をスローします)。返される Date
は、イベント終了時刻の深夜 0 時(スクリプトのタイムゾーン)を示します。代わりにカレンダーのタイムゾーンを使用するには、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
- このイベントが終日の予定でない場合
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getAllDayStartDate()
この終日のカレンダーの予定の開始日を取得します。(これが終日イベントでない場合、このメソッドは例外をスローします)。返される Date
は、イベントが開始されたスクリプトのタイムゾーンの午前 0 時を表します。代わりにカレンダーのタイムゾーンを使用するには、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
- このイベントが終日の予定でない場合
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getAllTagKeys()
イベントに対して設定されているタグのすべてのキーを取得します。
復路
String[]
- 文字列キーの配列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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. To create an event, use calendar.createEvent() 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
- イベントカラーの文字列表現。CalendarApp.EventColor
の値のインデックス(1 ~ 11)として表されます。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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. To create an event, use calendar.createEvent() 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[]
- イベント作成者のメールアドレス
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- 作成日
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- 説明
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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[]
- 各値が、リマインダーをトリガーするイベントの分数に対応する配列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getEndTime()
このカレンダーの予定の終了日時を取得します。カレンダーへのアクセス権が必要です。 終日以外のイベントの場合、これはイベントが定義された瞬間です。終了日のみを保存する終日の予定(日付と時刻は除く)の場合、カレンダーのタイムゾーンで予定が終了する日の午前 0 時です。これにより、すべてのタイプのイベントの終了時間を比較できます。ただし、必ずしも元の年が変更されていないわけではありません。
終日イベントの場合、ほとんどの場合、このメソッドよりも 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
- このカレンダーの予定の終了時間
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- そのイベントが属するイベント系列、またはまだ系列に含まれていない新しいイベント系列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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()); }
パラメータ
Name | 型 | 説明 |
---|---|---|
email | String | ゲストの住所 |
復路
EventGuest
- ゲスト(メールアドレスがゲストに対応していない場合は null)
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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[]
- ゲストの配列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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()); }
パラメータ
Name | 型 | 説明 |
---|---|---|
includeOwner | Boolean | オーナーをゲストとして使用するかどうか |
復路
EventGuest[]
- ゲストの配列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getId()
イベントの一意の iCalUID を取得します。iCalUID と、Calendar v3 API およびカレンダーの高度サービスで使用されるイベント id
は同一ではなく、混同して使用できません。セマンティクスの違いとして、定期的なイベントでは 1 つのイベントの発生がすべて異なっても、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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- 最終更新日
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- イベントの場所
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- ステータス
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getOriginalCalendarId()
この予定を最初に作成したカレンダーの ID を取得します。
// 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
- 元のカレンダーの ID
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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[]
- 各値が、リマインダーをトリガーするイベントの分数に対応する配列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getSmsReminders()
イベントのすべての SMS リマインダーの分値を取得します。
復路
Integer[]
- 各値が、リマインダーをトリガーするイベントの分数に対応する配列
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getStartTime()
このカレンダーの予定の開始日時を取得します。終日以外のイベントの場合、これはイベントの開始が定義された瞬間です。開始日のみ(日付と時刻ではなく)を保存する終日の予定の場合、これは、カレンダーのタイムゾーンで予定の開始日の深夜 0 時です。これにより、すべてのタイプのイベントの開始時間を比較できます。ただし、必ずしも元の年が変更されていないとは限りません。
終日イベントの場合、ほとんどの場合、このメソッドよりも 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
- このカレンダーの予定の開始時刻
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getTag(key)
イベントのタグ値を取得します。
パラメータ
Name | 型 | 説明 |
---|---|---|
key | String | 鍵 |
復路
String
- タグ値
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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@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
- タイトル
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
- 可視性の値
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
を指定します。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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 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); } }
パラメータ
Name | 型 | 説明 |
---|---|---|
email | String | ゲストのメールアドレス |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
date | Date | イベントの日付(時刻は無視されます) |
復路
CalendarEvent
- チェーン向けのこの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
startDate | Date | イベントの開始日(時刻は無視されます) |
endDate | Date | イベントの終了日(時刻は無視されます) |
復路
CalendarEvent
- チェーン向けのこの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
anyoneCanAddSelf | Boolean | 誰でも招待できるか |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
color | String | 文字列として整数のカラー インデックス、または CalendarApp.EventColor の値。 |
復路
CalendarEvent
- 連結用のカレンダー イベント。
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
description | String | 新しい説明文 |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
guestsCanInviteOthers | Boolean | ゲストが他のユーザーを招待できるかどうか |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanModify(guestsCanModify)
ゲストが予定を変更できるかどうかを指定します。
パラメータ
Name | 型 | 説明 |
---|---|---|
guestsCanModify | Boolean | ゲストが予定を変更できるかどうか |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanSeeGuests(guestsCanSeeGuests)
ゲストが他のゲストを閲覧できるかどうかを設定します。
パラメータ
Name | 型 | 説明 |
---|---|---|
guestsCanSeeGuests | Boolean | ゲストに他のユーザーが見えるかどうか |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
location | String | 新しい場所 |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
status | GuestStatus | 新しいステータス |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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-Value タグを設定します。
パラメータ
Name | 型 | 説明 |
---|---|---|
key | String | タグキー |
value | String | タグの値 |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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);
パラメータ
Name | 型 | 説明 |
---|---|---|
startTime | Date | 新しいイベントの開始 |
endTime | Date | 予定の新しい終了時間 |
復路
CalendarEvent
- チェーン向けのこの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する 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@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'); }
パラメータ
Name | 型 | 説明 |
---|---|---|
title | String | 新しいタイトル |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setVisibility(visibility)
予定の公開設定を設定します。
パラメータ
Name | 型 | 説明 |
---|---|---|
visibility | Visibility |
復路
CalendarEvent
- チェーン向けの CalendarEvent
認証
このメソッドを使用するスクリプトには、次の 1 つ以上のスコープまたは関連する REST API からの適切なスコープによる承認が必要です。
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds