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 rappel par e-mail à l'événement.
addGuest(email)CalendarEventSeriesAjoute un invité à l'événement.
addPopupReminder(minutesBefore)CalendarEventSeriesAjoute une notification pop-up à l'événement.
addSmsReminder(minutesBefore)CalendarEventSeriesAjoute 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.
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 tags définis au niveau de l'événement.
getColor()StringRenvoie 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 par e-mail pour l'événement.
getGuestByEmail(email)EventGuestRécupère un invité via son adresse e-mail.
getGuestList()EventGuest[]Récupère les invités à 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'UID iCal 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 concernant l'événement.
getSmsReminders()Integer[]Récupère les valeurs en minutes de tous les rappels par SMS de l'événement.
getTag(key)StringRécupère la valeur de la 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 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 à l'aide des paramètres par défaut de l'agenda.
setAnyoneCanAddSelf(anyoneCanAddSelf)CalendarEventSeriesDétermine si les utilisateurs qui ne sont pas des 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 (participant ou invité, par exemple) de l'utilisateur effectif.
setRecurrence(recurrence, startDate)CalendarEventSeriesDéfinit les règles de récurrence pour une série d'événements qui durent toute la journée.
setRecurrence(recurrence, startTime, endTime)CalendarEventSeriesDéfinit les règles de récurrence pour cette série d'événements.
setTag(key, value)CalendarEventSeriesDéfinit un tag clé-valeur sur l'événement afin de stocker des 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 rappel par e-mail à l'événement. Le rappel doit être défini entre cinq et quatre 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 précédant l'événement ;

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Génère

Error : si l'événement comprend plus de cinq rappels ou si l'heure n'est pas comprise dans la plage autorisée

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : CalendarEventSeries pour le chaînage.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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. Les notifications doivent être envoyées entre cinq et quatre 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 a pop-up notification for 15 minutes before the event.
event.addPopupReminder(15);

Paramètres

NomTypeDescription
minutesBeforeIntegerle nombre de minutes précédant l'événement ;

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 être défini entre cinq et quatre semaines (40 320 minutes) avant l'événement.

Paramètres

NomTypeDescription
minutesBeforeIntegerle nombre de minutes précédant l'événement ;

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Génère

Error : si l'événement comprend plus de cinq rappels ou si l'heure n'est pas comprise dans la plage autorisée

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 des personnes qui ne sont pas des invités peuvent s'ajouter à l'événement ; false dans le cas contraire.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

deleteEventSeries()

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

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

getAllTagKeys()

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

Renvois

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

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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()

Renvoie 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 de la couleur de l'événement sous la forme d'un index (1-11) des valeurs de CalendarApp.EventColor.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 associée à 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 associée à 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 associée à 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 par e-mail pour 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.
// 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 déclenché par un rappel.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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é via 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 : l'invité, ou la valeur "null" si l'adresse e-mail ne correspond pas à un invité

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 à 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 associée à 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
includeOwnerBooleans'il faut inclure 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 associée à 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'UID iCal de l'événement. Notez que l'identifiant iCalUID et l'événement id utilisés par l'API Calendar v3 et le service avancé 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 récurrents, toutes les occurrences d'un événement ont un ids différent alors qu'elles partagent les mêmes UID iCal.

// 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 associée à 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 associée à 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 associée à 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. 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.
// 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 associée à 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 associée à 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 concernant 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 déclenché par un rappel.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 par SMS de l'événement.

Renvois

Integer[] : tableau dans lequel chaque valeur correspond au nombre de minutes précédant l'événement déclenché par un rappel.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 la 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 associée à 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 associée à 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 associée à 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 dans le cas contraire.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 dans le cas contraire.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 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.
// 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 dans le cas contraire

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 dans le cas contraire.

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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 des 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.
// 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 quelqu'un peut s'inviter

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

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

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

setRecurrence(recurrence, startDate)

Définit les règles de récurrence pour une série d'événements qui durent toute la journée. L'application de cette méthode transforme une série d'événements standard en 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
recurrenceEventRecurrencerègles de récurrence à utiliser
startDateDateDate du premier événement de la série (seul le jour est utilisé, et l'heure est ignorée)

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

setRecurrence(recurrence, startTime, endTime)

Définit les règles de récurrence pour cette série d'événements. L'application de cette méthode transforme une série d'événements "Toute la journée" en 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
recurrenceEventRecurrencerègles de récurrence à utiliser
startTimeDateLa date et l'heure auxquelles commence le premier événement de la série
endTimeDateLa date et l'heure de fin du premier événement de la série

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

setTag(key, value)

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

Paramètres

NomTypeDescription
keyStringla clé de tag
valueStringla valeur de la balise

Renvois

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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

CalendarEventSeries : cette CalendarEventSeries pour le chaînage

Autorisation

Les scripts qui utilisent cette méthode nécessitent une autorisation associée à 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