Class CalendarEventSeries

CalendarEventSeries.

Représente une série d'événements (événement périodique).

Méthodes

MéthodeType renvoyéBrève description
addEmailReminder(minutesBefore)CalendarEventSeriesAjoute un e-mail de rappel à l'événement.
addGuest(email)CalendarEventSeriesAjoute un invité à l'événement.
addPopupReminder(minutesBefore)CalendarEventSeriesAjoute un nouveau rappel pop-up à l'événement.
addSmsReminder(minutesBefore)CalendarEventSeriesAjoute un rappel par SMS à l'événement.
anyoneCanAddSelf()BooleanDétermine si tous les utilisateurs peuvent s'inviter.
deleteEventSeries()voidSupprime la série d'événements.
deleteTag(key)CalendarEventSeriesSupprime un tag clé-valeur de l'événement.
getAllTagKeys()String[]Récupère toutes les clés des balises définies pour l'événement.
getColor()StringRenvoie la couleur de l'événement d'agenda.
getCreators()String[]Permet aux créateurs de l'événement.
getDateCreated()DateRécupère la date de création de l'événement.
getDescription()StringRécupère la description de l'événement.
getEmailReminders()Integer[]Récupère les minutes de tous les rappels par e-mail concernant l'événement.
getGuestByEmail(email)EventGuestRécupère un invité par son adresse e-mail.
getGuestList()EventGuest[]Récupère les invités de l'événement, à l'exclusion du propriétaire de l'événement.
getGuestList(includeOwner)EventGuest[]Récupère les invités de l'événement, y compris les propriétaires potentiels.
getId()StringRécupère l'unique iCalUID de l'événement.
getLastUpdated()DateRécupère la date de la dernière mise à jour de l'événement.
getLocation()StringRécupère le lieu de l'événement.
getMyStatus()GuestStatusRécupère l'état de l'événement (participant ou invité, par exemple) de l'utilisateur effectif.
getOriginalCalendarId()StringObtenez l'ID de l'agenda dans lequel cet événement a été créé.
getPopupReminders()Integer[]Récupère les minutes de tous les rappels pop-up pour l'événement.
getSmsReminders()Integer[]Récupère les minutes de tous les rappels par SMS pour l'événement.
getTag(key)StringRécupère une valeur de tag de l'événement.
getTitle()StringRécupère le titre de l'événement.
getVisibility()VisibilityRécupère la visibilité de l'événement.
guestsCanInviteOthers()BooleanDétermine si les invités peuvent inviter d'autres personnes.
guestsCanModify()BooleanDétermine si les invités peuvent modifier l'événement.
guestsCanSeeGuests()BooleanDétermine si les invités peuvent voir les autres invités.
isOwnedByMe()BooleanDétermine si vous êtes le propriétaire de l'événement.
removeAllReminders()CalendarEventSeriesSupprime tous les rappels de l'événement.
removeGuest(email)CalendarEventSeriesSupprime un invité de l'événement.
resetRemindersToDefault()CalendarEventSeriesRéinitialise les rappels en utilisant les paramètres par défaut de l'agenda.
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEventSeriesDétermine si les non-invités peuvent s'ajouter à l'événement.
setColor(color)CalendarEventSeriesDéfinit la couleur de l'événement d'agenda.
setDescription(description)CalendarEventSeriesDéfinit la description de l'événement.
setGuestsCanInviteOthers(guestsCanInviteOthers)CalendarEventSeriesDétermine si les invités peuvent inviter d'autres personnes.
setGuestsCanModify(guestsCanModify)CalendarEventSeriesDétermine si les invités peuvent modifier l'événement.
setGuestsCanSeeGuests(guestsCanSeeGuests)CalendarEventSeriesDétermine si les invités peuvent voir les autres invités.
setLocation(location)CalendarEventSeriesDéfinit le lieu de l'événement.
setMyStatus(status)CalendarEventSeriesDéfinit l'état de l'événement (par exemple, participation ou invité) de l'utilisateur effectif.
setRecurrence(recurrence, startDate)CalendarEventSeriesDéfinit les règles de récurrence d'une série d'événements durant une journée entière.
setRecurrence(recurrence, startTime, endTime)CalendarEventSeriesDéfinit les règles de récurrence de cette série d'événements.
setTag(key, value)CalendarEventSeriesDéfinit un tag clé/valeur sur l'événement pour stocker les métadonnées personnalisées.
setTitle(title)CalendarEventSeriesDéfinit le titre de l'événement.
setVisibility(visibility)CalendarEventSeriesDéfinit la visibilité de l'événement.

Documentation détaillée

addEmailReminder(minutesBefore)

Ajoute un e-mail de rappel à l'événement. Le rappel doit être effectué au moins cinq minutes et au plus quatre semaines (40 320 minutes) avant l'événement.

Paramètres

NomTypeDescription
minutesBeforeIntegerNombre de minutes avant l'événement

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Génère

Error : si l'événement comporte plus de cinq rappels ou si l'heure n'est pas comprise dans les limites légales

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

addGuest(email)

Ajoute un invité à l'événement.

// 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);
  }
}

Paramètres

NomTypeDescription
emailStringAdresse e-mail de l'invité.

Aller-retour

CalendarEventSeries : CalendarEventSeries pour le chaînage.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

addPopupReminder(minutesBefore)

Ajoute un nouveau rappel pop-up à l'événement. Le rappel doit être effectué au moins cinq minutes et au plus quatre semaines (40 320 minutes) avant l'événement.

Paramètres

NomTypeDescription
minutesBeforeIntegerNombre de minutes avant l'événement

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

addSmsReminder(minutesBefore)

Ajoute un rappel par SMS à l'événement. Le rappel doit être effectué au moins cinq minutes et au plus quatre semaines (40 320 minutes) avant l'événement.

Paramètres

NomTypeDescription
minutesBeforeIntegerNombre de minutes avant l'événement

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Génère

Error : si l'événement comporte plus de cinq rappels ou si l'heure n'est pas comprise dans les limites légales

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

anyoneCanAddSelf()

Détermine si tous les utilisateurs peuvent s'inviter.

Aller-retour

Boolean : true si les personnes non invitées peuvent s'ajouter à l'événement ; false dans le cas contraire

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

deleteEventSeries()

Supprime la série d'événements.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

deleteTag(key)

Supprime un tag clé-valeur de l'événement.

Paramètres

NomTypeDescription
keyStringla clé du tag

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getAllTagKeys()

Récupère toutes les clés des balises définies pour l'événement.

Aller-retour

String[] : tableau de clés de chaîne

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getColor()

Renvoie la couleur de l'événement d'agenda.

Aller-retour

String : représentation de la couleur de l'événement sous forme de chaîne (1-11) des valeurs de CalendarApp.EventColor.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getCreators()

Permet aux créateurs de l'événement.

Aller-retour

String[] : adresse e-mail des créateurs de l'événement

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getDateCreated()

Récupère la date de création de l'événement. Vous devez avoir accès à l'agenda.

// 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.
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');
}

Aller-retour

Date : date de création

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getDescription()

Récupère la description de l'événement. Vous devez être autorisé à modifier l'agenda.

// 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.
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');
}

Aller-retour

String : description

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getEmailReminders()

Récupère les minutes de tous les rappels par e-mail concernant l'événement. Vous devez être autorisé à modifier l'agenda.

// 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.
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');
}

Aller-retour

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes avant le déclenchement d'un rappel

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getGuestByEmail(email)

Récupère un invité par son adresse e-mail.

// 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.
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());
}

Paramètres

NomTypeDescription
emailStringl'adresse de l'invité.

Aller-retour

EventGuest : invité, ou valeur null si l'adresse e-mail ne correspond pas à un invité

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getGuestList()

Récupère les invités de l'événement, à l'exclusion du propriétaire de l'événement.

// 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.
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());
}

Aller-retour

EventGuest[] : tableau des invités

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getGuestList(includeOwner)

Récupère les invités de l'événement, y compris les propriétaires potentiels.

// 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.
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());
}

Paramètres

NomTypeDescription
includeOwnerBooleansi les propriétaires doivent être invités

Aller-retour

EventGuest[] : tableau des invités

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getId()

Récupère l'unique iCalUID de l'événement. Notez que iCalUID et l'événement id utilisés par l'API Calendar v3 et le service avancé d'Agenda ne sont pas identiques et ne peuvent pas être utilisés de manière interchangeable. L'une des différences sémantiques réside dans le fait que, dans les événements périodiques, toutes les occurrences d'un événement ont des valeurs ids différentes alors qu'elles partagent toutes les mêmes 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.
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());

Aller-retour

String : iCalUID de l'événement.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getLastUpdated()

Récupère la date de la dernière mise à jour de l'événement.

// 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.
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);

Aller-retour

Date : date de la dernière mise à jour

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getLocation()

Récupère le lieu de l'événement.

// 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];

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');
}

Aller-retour

String : emplacement de l'événement

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getMyStatus()

Récupère l'état de l'événement (participant ou invité, par exemple) de l'utilisateur effectif. Renvoie toujours GuestStatus.OWNER si l'utilisateur effectif est le propriétaire de l'événement.

// 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.
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');
}

Aller-retour

GuestStatus : état

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getOriginalCalendarId()

Obtenez l'ID de l'agenda dans lequel cet événement a été créé.

// 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.
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');
}

Aller-retour

String : ID de l'agenda d'origine

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getPopupReminders()

Récupère les minutes de tous les rappels pop-up pour l'événement.

  // 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.
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');
}

Aller-retour

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes avant le déclenchement d'un rappel

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getSmsReminders()

Récupère les minutes de tous les rappels par SMS pour l'événement.

Aller-retour

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes avant le déclenchement d'un rappel

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getTag(key)

Récupère une valeur de tag de l'événement.

Paramètres

NomTypeDescription
keyStringla clé

Aller-retour

String : valeur de la balise

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getTitle()

Récupère le titre de l'événement.

// 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.
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');
}

Aller-retour

String : titre

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

getVisibility()

Récupère la visibilité de l'événement.

// 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];

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');
}

Aller-retour

Visibility : valeur de visibilité

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

guestsCanInviteOthers()

Détermine si les invités peuvent inviter d'autres personnes.

// 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.
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');
}

Aller-retour

Boolean : true si les invités peuvent inviter d'autres personnes ; false dans le cas contraire

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

guestsCanModify()

Détermine si les invités peuvent modifier l'événement.

// 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.
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');
}

Aller-retour

Boolean : true si les invités peuvent modifier l'événement, false dans le cas contraire

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

guestsCanSeeGuests()

Détermine si les invités peuvent voir les autres invités.

// 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.
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');
}

Aller-retour

Boolean : true si les invités peuvent voir les autres invités ; false dans le cas contraire

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

isOwnedByMe()

Détermine si vous êtes le propriétaire de l'événement.

// 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];

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');
}

Aller-retour

Boolean : true si l'événement appartient à l'utilisateur effectif ; false dans le cas contraire.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

removeAllReminders()

Supprime tous les rappels de l'événement.

// 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 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');
}

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

removeGuest(email)

Supprime un invité de l'événement.

// 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);
  }
}

Paramètres

NomTypeDescription
emailStringAdresse e-mail de l'invité

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

resetRemindersToDefault()

Réinitialise les rappels en utilisant les paramètres par défaut de l'agenda.

// 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 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');
}

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setAnyoneCanAddSelf(anyoneCanAddSelf)

Détermine si les non-invités peuvent s'ajouter à l'événement.

// 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.
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');
}

Paramètres

NomTypeDescription
anyoneCanAddSelfBooleansi chacun peut s'inviter

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setColor(color)

Définit la couleur de l'événement d'agenda.

// 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];

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');
}

Paramètres

NomTypeDescription
colorStringIndex de couleur sous forme de nombre entier sous forme de chaîne ou de valeur provenant de CalendarApp.EventColor.

Aller-retour

CalendarEventSeries : cet événement d'agenda, pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setDescription(description)

Définit la description de l'événement.

// 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.
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');
}

Paramètres

NomTypeDescription
descriptionStringla nouvelle description

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setGuestsCanInviteOthers(guestsCanInviteOthers)

Détermine si les invités peuvent inviter d'autres personnes.

// 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.
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');
}

Paramètres

NomTypeDescription
guestsCanInviteOthersBooleansi les invités peuvent inviter d'autres personnes

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setGuestsCanModify(guestsCanModify)

Détermine si les invités peuvent modifier l'événement.

Paramètres

NomTypeDescription
guestsCanModifyBooleansi les invités peuvent modifier l'événement

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setGuestsCanSeeGuests(guestsCanSeeGuests)

Détermine si les invités peuvent voir les autres invités.

Paramètres

NomTypeDescription
guestsCanSeeGuestsBooleansi les invités peuvent voir les autres participants

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setLocation(location)

Définit le lieu de l'événement.

// 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];

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');
}

Paramètres

NomTypeDescription
locationStringle nouvel emplacement

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setMyStatus(status)

Définit l'état de l'événement (par exemple, participation ou invité) de l'utilisateur effectif.

// 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];

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');
}

Paramètres

NomTypeDescription
statusGuestStatusle nouvel état

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setRecurrence(recurrence, startDate)

Définit les règles de récurrence d'une série d'événements durant une journée entière. L'application de cette méthode convertit une série d'événements standard en une série d'événements d'une journée entière.

// Sets the events in a series to take place every Wednesday in 2013.
var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com');
var startDate = new Date('January 2, 2013 03:00:00 PM EST');
var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
    .onlyOnWeekday(CalendarApp.Weekday.WEDNESDAY)
    .until(new Date('January 1, 2014'));
eventSeries.setRecurrence(recurrence, startDate);

Paramètres

NomTypeDescription
recurrenceEventRecurrenceles règles de récurrence
startDateDateDate du premier événement de la série (seul le jour est utilisé ; l'heure est ignorée)

Aller-retour

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setRecurrence(recurrence, startTime, endTime)

Définit les règles de récurrence de cette série d'événements. L'application de cette méthode convertit une série d'événements "Toute la journée" en une série d'événements standard.

// Sets the events in a series to take place from 3pm to 4pm every Tuesday and Thursday in
// 2013.
var eventSeries = CalendarApp.getDefaultCalendar().getEventSeriesById('123456789@google.com');
var startTime = new Date('January 1, 2013 03:00:00 PM EST');
var endTime = new Date('January 1, 2013 04:00:00 PM EST');
var recurrence = CalendarApp.newRecurrence().addWeeklyRule()
     .onlyOnWeekdays([CalendarApp.Weekday.TUESDAY, CalendarApp.Weekday.THURSDAY])
     .until(new Date('January 1, 2014'));
eventSeries.setRecurrence(recurrence, startTime, endTime);

Paramètres

NomTypeDescription
recurrenceEventRecurrenceles règles de récurrence
startTimeDateDate et heure de début du premier événement de la série
endTimeDateDate et heure de fin du premier événement de la série

Aller-retour

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setTag(key, value)

Définit un tag clé/valeur sur l'événement pour stocker les métadonnées personnalisées.

Paramètres

NomTypeDescription
keyStringla clé du tag
valueStringla valeur du tag

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setTitle(title)

Définit le titre de l'événement.

// 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.
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');
}

Paramètres

NomTypeDescription
titleStringle nouveau titre

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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

setVisibility(visibility)

Définit la visibilité de l'événement.

Paramètres

NomTypeDescription
visibilityVisibility

Aller-retour

CalendarEventSeries : cet élément (CalendarEventSeries) pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants ou les champs d'application appropriés de l'API REST associée:

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