Class CalendarEvent

CalendarEvent

Représente un seul événement d'agenda.

Méthodes

MéthodeType renvoyéBrève description
addEmailReminder(minutesBefore)CalendarEventAjoute un rappel par e-mail à l'événement.
addGuest(email)CalendarEventAjoute un invité à l'événement.
addPopupReminder(minutesBefore)CalendarEventAjoute une notification pop-up à l'événement.
addSmsReminder(minutesBefore)CalendarEventAjoute un rappel par SMS à l'événement.
anyoneCanAddSelf()BooleanDétermine si les utilisateurs peuvent s'ajouter en tant qu'invités à un événement Agenda.
deleteEvent()voidSupprime un événement d'agenda.
deleteTag(key)CalendarEventSupprime un tag clé-valeur de l'événement.
getAllDayEndDate()DateRécupère la date de fin de cet événement d'agenda qui dure toute la journée.
getAllDayStartDate()DateRécupère la date à laquelle cet événement d'une journée commence.
getAllTagKeys()String[]Récupère toutes les clés des tags définis pour l'événement.
getColor()StringAffiche la couleur de l'événement d'agenda.
getCreators()String[]Récupère les créateurs d'un é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 valeurs en minutes de tous les rappels envoyés par e-mail pour l'événement.
getEndTime()DateRécupère la date et l'heure de fin de cet événement d'agenda.
getEventSeries()CalendarEventSeriesRécupère la série d'événements périodiques à laquelle appartient cet é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 à l'événement, y compris les propriétaires de l'événement.
getId()StringRécupère l'identifiant iCal unique 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 valeurs en minutes de tous les rappels pop-up associés à l'événement.
getSmsReminders()Integer[]Récupère les valeurs en minutes de tous les rappels envoyés par SMS pour l'événement.
getStartTime()DateRécupère la date et l'heure auxquelles cet événement d'agenda commence.
getTag(key)StringRécupère la valeur de balise 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 d'autres invités.
isAllDayEvent()BooleanDétermine s'il s'agit d'un événement d'une journée entière.
isOwnedByMe()BooleanDétermine si vous êtes le propriétaire de l'événement.
isRecurringEvent()BooleanDétermine si l'événement fait partie d'une série d'événements.
removeAllReminders()CalendarEventSupprime tous les rappels de l'événement.
removeGuest(email)CalendarEventSupprime un invité de l'événement.
resetRemindersToDefault()CalendarEventRéinitialise les rappels à l'aide des paramètres par défaut de l'agenda.
setAllDayDate(date)CalendarEventDéfinit la date de l'événement.
setAllDayDates(startDate, endDate)CalendarEventDéfinit les dates de l'événement.
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEventDétermine si les utilisateurs qui ne sont pas invités peuvent s'ajouter eux-mêmes à l'événement.
setColor(color)CalendarEventDéfinit la couleur de l'événement d'agenda.
setDescription(description)CalendarEventDéfinit la description de l'événement.
setGuestsCanInviteOthers(guestsCanInviteOthers)CalendarEventDétermine si les invités peuvent inviter d'autres personnes.
setGuestsCanModify(guestsCanModify)CalendarEventDétermine si les invités peuvent modifier l'événement.
setGuestsCanSeeGuests(guestsCanSeeGuests)CalendarEventDétermine si les invités peuvent voir les autres invités.
setLocation(location)CalendarEventDéfinit le lieu de l'événement.
setMyStatus(status)CalendarEventDéfinit l'état de l'événement (participant ou invité, par exemple) de l'utilisateur effectif.
setTag(key, value)CalendarEventDéfinit un tag clé-valeur sur l'événement pour stocker des métadonnées personnalisées.
setTime(startTime, endTime)CalendarEventDéfinit les dates et heures de début et de fin de l'événement.
setTitle(title)CalendarEventDéfinit le titre de l'événement.
setVisibility(visibility)CalendarEventDéfinit la visibilité de l'événement.

Documentation détaillée

addEmailReminder(minutesBefore)

Ajoute un rappel par e-mail à l'événement. Le rappel doit durer au moins cinq minutes et quatre minutes au maximum. semaines (40 320 minutes) avant l'événement.

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

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

Paramètres

NomTypeDescription
minutesBeforeIntegerLe nombre de minutes avant l'événement

Renvois

CalendarEvent : CalendarEvent pour le chaînage

Génère

Error : s'il y a plus de cinq rappels pour l'événement ou si l'heure n'est pas spécifiée dans la plage légale

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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é.

Renvois

CalendarEvent : CalendarEvent 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 des 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 une notification pop-up à l'événement. La notification doit durer au moins cinq minutes. quatre semaines (40 320 minutes maximum) avant l'événement.

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

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

Paramètres

NomTypeDescription
minutesBeforeIntegerLe nombre de minutes avant l'événement

Renvois

CalendarEvent : CalendarEvent 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 des 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 durer au moins cinq minutes et quatre minutes au maximum. semaines (40 320 minutes) avant l'événement.

Paramètres

NomTypeDescription
minutesBeforeIntegerLe nombre de minutes avant l'événement

Renvois

CalendarEvent : CalendarEvent pour le chaînage

Génère

Error : s'il y a plus de cinq rappels pour l'événement ou si l'heure n'est pas spécifiée dans la plage légale

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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 les utilisateurs peuvent s'ajouter en tant qu'invités à un événement Agenda.

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

// Determines whether people can add themselves as guests to the event and logs it.
console.log(event.anyoneCanAddSelf());

Renvois

Boolean : true si les utilisateurs qui ne sont pas invités peuvent s'ajouter eux-mêmes à l'événement false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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

deleteEvent()

Supprime un événement d'agenda.

// Gets an event by its ID.
// TODO(developer): Replace the string with the ID of the event that you want to delete.
const event = CalendarApp.getEventById('abc123456');

// Deletes the event.
event.deleteEvent();

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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é de tag

Renvois

CalendarEvent : CalendarEvent 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 des champs d'application appropriés de l'API REST associée:

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

getAllDayEndDate()

Récupère la date de fin de cet événement d'agenda qui dure toute la journée. (S'il ne s'agit pas d'un événement d'une journée entière, cette méthode génère une exception.) L'élément Date renvoyé représente minuit au moment début de la journée suivant la fin de l'événement dans le fuseau horaire du script. Pour utiliser la fuseau horaire de votre agenda, appelez 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);

Renvois

Date : date de fin de cet événement d'agenda d'une journée entière

Génère

Error : si cet événement dure pas toute la journée

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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

getAllDayStartDate()

Récupère la date à laquelle cet événement d'agenda d'une journée commence. (S'il ne s'agit pas d'un événement d'une journée, cette méthode génère alors une exception.) L'élément Date renvoyé représente minuit au moment début de la journée à laquelle l'événement commence dans le fuseau horaire du script. Pour utiliser la fuseau horaire de votre agenda, appelez 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);

Renvois

Date : date de début de cet événement d'agenda qui dure toute la journée

Génère

Error : si cet événement dure pas toute la journée

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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

getAllTagKeys()

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

Renvois

String[] : un 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 des 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()

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

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

// Gets the color of the calendar event and logs it.
const eventColor = event.getColor();
console.log(eventColor);

Renvois

String : représentation sous forme de chaîne de la couleur de l'événement, sous la forme d'un indice (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 des 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()

Récupère les créateurs d'un événement.

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

// Gets a list of the creators of the event and logs it.
console.log(event.getCreators());

Renvois

String[] : adresses 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 des 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.
// 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');
}

Renvois

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

Renvois

String : description

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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 valeurs en minutes de tous les rappels envoyés par e-mail pour l'événement. Vous devez être autorisé à modifier 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.
// 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');
}

Renvois

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes précédant l'événement 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 des 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

getEndTime()

Récupère la date et l'heure de fin de cet événement d'agenda. Vous devez avoir accès à l'agenda. Pour les événements qui ne durent pas toute la journée, il s'agit de l'heure à laquelle l'événement a été défini à la fin. Pour les événements d'une journée entière, qui stockent uniquement une date de fin (et non une date et une heure), c'est minuit. au début de la journée suivant la fin de l'événement dans le fuseau horaire de l'agenda. Ce permet de comparer de manière significative les heures de fin pour tous les types d'événements ; mais pas conserver nécessairement le jour de l'année d'origine tel quel.

Pour les événements d'une journée entière, getAllDayEndDate() devrait presque soit toujours appelée au lieu de cette méthode.

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

Renvois

Date : heure de fin de cet événement d'agenda

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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

getEventSeries()

Récupère la série d'événements périodiques à laquelle appartient cet événement. Vous devez avoir accès Agenda. Un objet CalendarEventSeries est renvoyé même si cet événement n'appartient pas à une série, afin de pouvoir ajouter de nouveaux paramètres de récurrence.

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

Renvois

CalendarEventSeries : série d'événements à laquelle appartient cet événement ou nouvelle série d'événements qui n'en fait pas encore partie à une série

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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());
}

Paramètres

NomTypeDescription
emailStringl'adresse de l'invité

Renvois

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

Renvois

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 des 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 à l'événement, y compris les propriétaires 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.
// 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());
}

Paramètres

NomTypeDescription
includeOwnerBooleaninclure ou non les propriétaires en tant qu'invités

Renvois

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 des 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'identifiant iCal unique de l'événement. Notez que le paramètre iCalUID et l'événement id utilisé par le L'API Calendar v3 et le service avancé Agenda ne sont pas identiques. ne peuvent pas être utilisés de manière interchangeable. L'une des différences de leur sémantique est que pour les événements récurrents, toutes les occurrences d'un événement ont des ids différents alors qu'elles partagent le même identifiant 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());

Renvois

String : identifiant iCal 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 des 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.
// 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);

Renvois

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

Renvois

String : lieu 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 des 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. Toujours retour 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.
// 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');
}

Renvois

GuestStatus : état

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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');
}

Renvois

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 des 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 valeurs en minutes de tous les rappels pop-up associés à 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.
// 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');
}

Renvois

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes précédant l'événement 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 des 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 valeurs en minutes de tous les rappels envoyés par SMS pour l'événement.

Renvois

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes précédant l'événement 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 des 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

getStartTime()

Récupère la date et l'heure auxquelles cet événement d'agenda commence. Pour les événements qui n'ont pas une journée entière, correspond à l'instant où l'événement a été défini pour commencer. Pour les événements d'une journée, une date de début (et non une date et une heure), c'est-à-dire minuit au début de la journée L'événement commence dans le fuseau horaire de l'agenda. Cela permet de comparer de manière significative les heures de début de tous les types d'événements ; mais la création d'origine n'est pas forcément conservée jour de l'année non modifié.

Pour les événements d'une journée entière, getAllDayStartDate() doit soit presque toujours appelé plutôt que cette méthode.

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

Renvois

Date : heure de début de cet événement d'agenda

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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 la valeur de balise de l'événement.

Paramètres

NomTypeDescription
keyStringla clé

Renvois

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

Renvois

String : titre

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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');
}

Renvois

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

Renvois

Boolean : true si les invités peuvent inviter d'autres personnes false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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');
}

Renvois

Boolean : true si les invités peuvent modifier l'événement false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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 d'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.
// 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');
}

Renvois

Boolean : true si les invités peuvent voir les autres invités false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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

isAllDayEvent()

Détermine s'il s'agit d'un événement d'une journée entière.

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

Renvois

Boolean : true si l'événement dure toute la journée false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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');
}

Renvois

Boolean : true si l'événement appartient à l'utilisateur effectif false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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

isRecurringEvent()

Détermine si l'événement fait partie d'une série d'événements.

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

Renvois

Boolean : true si l'événement fait partie d'une série d'événements false si ce n'est pas le cas

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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');
}

Renvois

CalendarEvent : CalendarEvent 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 des 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
emailStringL'adresse e-mail de l'invité

Renvois

CalendarEvent : CalendarEvent 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 des 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 à l'aide des 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.
// 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');
}

Renvois

CalendarEvent : CalendarEvent 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 des champs d'application appropriés de l'API REST associée:

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

setAllDayDate(date)

Définit la date de l'événement. Cette méthode permet de transformer un événement standard en événement d'une journée entière.

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

Paramètres

NomTypeDescription
dateDateLa date de l'événement (l'heure n'est pas prise en compte)

Renvois

CalendarEvent : cet événement CalendarEvent 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 des champs d'application appropriés de l'API REST associée:

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

setAllDayDates(startDate, endDate)

Définit les dates de l'événement. Cette méthode permet de transformer un événement standard en événement de type "Toute la journée" .

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

Paramètres

NomTypeDescription
startDateDateLa date de début de l'événement (l'heure est ignorée)
endDateDateLa date de fin de l'événement (l'heure n'est pas prise en compte)

Renvois

CalendarEvent : cet événement CalendarEvent 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 des 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 utilisateurs qui ne sont pas invités peuvent s'ajouter eux-mêmes à 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.
// 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');
}

Paramètres

NomTypeDescription
anyoneCanAddSelfBooleansi tout le monde peut s'inviter

Renvois

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

Paramètres

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

Renvois

CalendarEvent : cet événement d'agenda, pour l'enchaînement.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation avec un ou plusieurs des champs d'application suivants, ou des 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.
// 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');
}

Paramètres

NomTypeDescription
descriptionStringla nouvelle description

Renvois

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

Paramètres

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

Renvois

CalendarEvent : CalendarEvent 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 des 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

Renvois

CalendarEvent : CalendarEvent 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 des 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

Renvois

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

Paramètres

NomTypeDescription
locationStringle nouvel emplacement

Renvois

CalendarEvent : CalendarEvent 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 des 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 (participant ou invité, par exemple) 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.
// 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');
}

Paramètres

NomTypeDescription
statusGuestStatusle nouvel état

Renvois

CalendarEvent : CalendarEvent 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 des 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

setTag(key, value)

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

Paramètres

NomTypeDescription
keyStringla clé de tag
valueStringla valeur de la balise

Renvois

CalendarEvent : CalendarEvent 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 des champs d'application appropriés de l'API REST associée:

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

setTime(startTime, endTime)

Définit les dates et heures de début et de fin de l'événement. L'application de cette méthode modifie d'un événement d'une journée en événement standard.

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

Paramètres

NomTypeDescription
startTimeDatele nouveau début de l'événement ;
endTimeDatela nouvelle fin de l'événement

Renvois

CalendarEvent : cet événement CalendarEvent 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 des 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.
// 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');
}

Paramètres

NomTypeDescription
titleStringle nouveau titre

Renvois

CalendarEvent : CalendarEvent 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 des 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

Renvois

CalendarEvent : CalendarEvent 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 des champs d'application appropriés de l'API REST associée:

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