Representa uma série de eventos (um evento recorrente).
Métodos
Método | Tipo de retorno | Breve descrição |
---|---|---|
addEmailReminder(minutesBefore) | CalendarEventSeries | Adiciona um novo lembrete por e-mail ao evento. |
addGuest(email) | CalendarEventSeries | Adiciona um convidado ao evento. |
addPopupReminder(minutesBefore) | CalendarEventSeries | Adiciona uma nova notificação pop-up ao evento. |
addSmsReminder(minutesBefore) | CalendarEventSeries | Adiciona um novo lembrete por SMS ao evento. |
anyoneCanAddSelf() | Boolean | Determina se as pessoas podem se adicionar como convidados a um evento do Google Agenda. |
deleteEventSeries() | void | Exclui a série de eventos. |
deleteTag(key) | CalendarEventSeries | Exclui uma tag de chave-valor do evento. |
getAllTagKeys() | String[] | Recebe todas as chaves das tags que foram definidas no evento. |
getColor() | String | Retorna a cor do evento da agenda. |
getCreators() | String[] | Acessa os criadores de um evento. |
getDateCreated() | Date | Extrai a data em que o evento foi criado. |
getDescription() | String | Recebe a descrição do evento. |
getEmailReminders() | Integer[] | Extrai os valores de minutos de todos os lembretes por e-mail do evento. |
getGuestByEmail(email) | EventGuest | Recebe um convidado por endereço de e-mail. |
getGuestList() | EventGuest[] | Recebe os convidados do evento, sem incluir o proprietário. |
getGuestList(includeOwner) | EventGuest[] | Recebe os convidados do evento, possivelmente incluindo os proprietários. |
getId() | String | Recebe o iCalUID exclusivo do evento. |
getLastUpdated() | Date | Extrai a data da última atualização do evento. |
getLocation() | String | Extrai o local do evento. |
getMyStatus() | GuestStatus | Acessa o status do evento (como participando ou convidado) do usuário efetivo. |
getOriginalCalendarId() | String | Encontre o ID da agenda em que o evento foi criado originalmente. |
getPopupReminders() | Integer[] | Recebe os valores de minuto de todos os lembretes pop-up do evento. |
getSmsReminders() | Integer[] | Recebe os valores de minutos de todos os lembretes por SMS do evento. |
getTag(key) | String | Recebe um valor de tag do evento. |
getTitle() | String | Recebe o título do evento. |
getVisibility() | Visibility | Recebe a visibilidade do evento. |
guestsCanInviteOthers() | Boolean | Determina se os convidados podem convidar outras pessoas. |
guestsCanModify() | Boolean | Determina se os convidados podem modificar o evento. |
guestsCanSeeGuests() | Boolean | Determina se os convidados podem ver outros convidados. |
isOwnedByMe() | Boolean | Determina se você é o proprietário do evento. |
removeAllReminders() | CalendarEventSeries | Remove todos os lembretes do evento. |
removeGuest(email) | CalendarEventSeries | Remove um convidado do evento. |
resetRemindersToDefault() | CalendarEventSeries | Para redefinir os lembretes, use as configurações padrão da agenda. |
setAnyoneCanAddSelf(anyoneCanAddSelf) | CalendarEventSeries | Define se pessoas que não são convidados podem se adicionar ao evento. |
setColor(color) | CalendarEventSeries | Define a cor do evento da agenda. |
setDescription(description) | CalendarEventSeries | Define a descrição do evento. |
setGuestsCanInviteOthers(guestsCanInviteOthers) | CalendarEventSeries | Define se os convidados podem convidar outras pessoas. |
setGuestsCanModify(guestsCanModify) | CalendarEventSeries | Define se os convidados podem modificar o evento. |
setGuestsCanSeeGuests(guestsCanSeeGuests) | CalendarEventSeries | Define se os convidados podem ver outros convidados. |
setLocation(location) | CalendarEventSeries | Define o local do evento. |
setMyStatus(status) | CalendarEventSeries | Define o status do evento (como participante ou convidado) do usuário efetivo. |
setRecurrence(recurrence, startDate) | CalendarEventSeries | Define as regras de recorrência para uma série de eventos de dia inteiro. |
setRecurrence(recurrence, startTime, endTime) | CalendarEventSeries | Define as regras de recorrência desta série de eventos. |
setTag(key, value) | CalendarEventSeries | Define uma tag de chave-valor no evento para armazenar metadados personalizados. |
setTitle(title) | CalendarEventSeries | Define o título do evento. |
setVisibility(visibility) | CalendarEventSeries | Define a visibilidade do evento. |
Documentação detalhada
addEmailReminder(minutesBefore)
Adiciona um novo lembrete por e-mail ao evento. O lembrete precisa ser de pelo menos cinco minutos e no máximo quatro semanas (40.320 minutos) antes do evento.
// 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);
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
minutesBefore | Integer | o número de minutos antes do evento |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Gera
Error
: se houver mais de cinco lembretes no evento ou o horário não estiver dentro do intervalo legal
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addGuest(email)
Adiciona um convidado ao evento.
// 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); } }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
email | String | O endereço de e-mail do convidado. |
Retorno
CalendarEventSeries
: esse CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addPopupReminder(minutesBefore)
Adiciona uma nova notificação pop-up ao evento. A notificação precisa ser feita entre cinco e quatro semanas (40.320 minutos) antes do evento.
// 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);
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
minutesBefore | Integer | o número de minutos antes do evento |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
addSmsReminder(minutesBefore)
Adiciona um novo lembrete por SMS ao evento. O lembrete precisa ser de pelo menos cinco minutos e no máximo quatro semanas (40.320 minutos) antes do evento.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
minutesBefore | Integer | o número de minutos antes do evento |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Gera
Error
: se houver mais de cinco lembretes no evento ou o horário não estiver dentro do intervalo legal
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
anyoneCanAddSelf()
Determina se as pessoas podem se adicionar como convidados a um evento do Google 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());
Retorno
Boolean
: true
se não houver convidados que possam se adicionar ao evento. Caso contrário, false
.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
deleteEventSeries()
Exclui a série de eventos.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
deleteTag(key)
Exclui uma tag de chave-valor do evento.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
key | String | a chave da tag |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
getAllTagKeys()
Recebe todas as chaves das tags que foram definidas no evento.
Retorno
String[]
: uma matriz de chaves de string
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getColor()
Retorna a cor do evento da 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);
Retorno
String
: a representação de string da cor do evento, como um índice (1 a 11) de valores de CalendarApp.EventColor
.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getCreators()
Acessa os criadores de um evento.
// 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());
Retorno
String[]
: os endereços de e-mail dos criadores do evento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getDateCreated()
Extrai a data em que o evento foi criado. Você precisa ter acesso à 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'); }
Retorno
Date
: a data de criação.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getDescription()
Recebe a descrição do evento. Você precisa ter acesso para editar a 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'); }
Retorno
String
: a descrição
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getEmailReminders()
Extrai os valores de minutos de todos os lembretes por e-mail do evento. É preciso ter acesso para editar a 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'); }
Retorno
Integer[]
: uma matriz em que cada valor corresponde ao número de minutos antes do evento acionado por um lembrete.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getGuestByEmail(email)
Recebe um convidado por endereço de 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()); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
email | String | o endereço do convidado |
Retorno
EventGuest
: o convidado ou nulo se o endereço de e-mail não corresponder a um convidado.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
getGuestList()
Recebe os convidados do evento, sem incluir o proprietário.
// 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()); }
Retorno
EventGuest[]
: uma matriz dos convidados.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getGuestList(includeOwner)
Recebe os convidados do evento, possivelmente incluindo os proprietários.
// 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()); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
includeOwner | Boolean | se quer incluir os proprietários como convidados |
Retorno
EventGuest[]
: uma matriz dos convidados.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getId()
Recebe o iCalUID exclusivo do evento. Observe que o iCalUID e o evento id
usados pela API Calendar v3 e pelo serviço avançado do Google Agenda não são idênticos e não podem ser usados de maneira intercambiável. Uma diferença na semântica é que, em eventos recorrentes, todas as ocorrências de um evento têm ids
diferentes, enquanto todas compartilham os mesmos iCalUIDs.
// 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());
Retorno
String
: o iCalUID do evento
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getLastUpdated()
Extrai a data da última atualização do evento.
// 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);
Retorno
Date
: a data da última atualização
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getLocation()
Extrai o local do evento.
// 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'); }
Retorno
String
: o local do evento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getMyStatus()
Acessa o status do evento (como participando ou convidado) do usuário efetivo. Sempre retornará GuestStatus.OWNER
se o usuário efetivo for o proprietário do evento.
// 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'); }
Retorno
GuestStatus
: o status.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getOriginalCalendarId()
Encontre o ID da agenda em que o evento foi criado originalmente.
// 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'); }
Retorno
String
: o código da agenda original.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getPopupReminders()
Recebe os valores de minuto de todos os lembretes pop-up do evento.
// 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'); }
Retorno
Integer[]
: uma matriz em que cada valor corresponde ao número de minutos antes do evento acionado por um lembrete.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getSmsReminders()
Recebe os valores de minutos de todos os lembretes por SMS do evento.
Retorno
Integer[]
: uma matriz em que cada valor corresponde ao número de minutos antes do evento acionado por um lembrete.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getTag(key)
Recebe um valor de tag do evento.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
key | String | a chave |
Retorno
String
: o valor da tag
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getTitle()
Recebe o título do evento.
// 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'); }
Retorno
String
: o título
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
getVisibility()
Recebe a visibilidade do evento.
// 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'); }
Retorno
Visibility
: o valor de visibilidade
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
guestsCanInviteOthers()
Determina se os convidados podem convidar outras pessoas.
// 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'); }
Retorno
Boolean
: true
se os convidados puderem convidar outras pessoas; se não for o caso, false
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
guestsCanModify()
Determina se os convidados podem modificar o evento.
// 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'); }
Retorno
Boolean
: true
se os convidados puderem modificar o evento; false
se não puderem.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
guestsCanSeeGuests()
Determina se os convidados podem ver outros convidados.
// 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'); }
Retorno
Boolean
: true
se os convidados puderem ver outros convidados; false
se não puderem.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
isOwnedByMe()
Determina se você é o proprietário do evento.
// 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'); }
Retorno
Boolean
: true
se o evento pertencer ao usuário efetivo; false
se não for
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
removeAllReminders()
Remove todos os lembretes do evento.
// 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'); }
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
removeGuest(email)
Remove um convidado do evento.
// 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); } }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
email | String | o endereço de e-mail do convidado |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
resetRemindersToDefault()
Para redefinir os lembretes, use as configurações padrão da 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'); }
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setAnyoneCanAddSelf(anyoneCanAddSelf)
Define se pessoas que não são convidados podem se adicionar ao evento.
// 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
anyoneCanAddSelf | Boolean | se qualquer um pode convidar a si mesmo |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setColor(color)
Define a cor do evento da 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
color | String | Um índice de cores em números inteiros como uma string ou um valor de CalendarApp.EventColor . |
Retorno
CalendarEventSeries
: evento da agenda para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setDescription(description)
Define a descrição do evento.
// 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
description | String | a nova descrição |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanInviteOthers(guestsCanInviteOthers)
Define se os convidados podem convidar outras pessoas.
// 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
guestsCanInviteOthers | Boolean | se convidados podem convidar outras pessoas |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanModify(guestsCanModify)
Define se os convidados podem modificar o evento.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
guestsCanModify | Boolean | se os convidados podem modificar o evento |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setGuestsCanSeeGuests(guestsCanSeeGuests)
Define se os convidados podem ver outros convidados.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
guestsCanSeeGuests | Boolean | se os convidados podem ver outras pessoas |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setLocation(location)
Define o local do evento.
// 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
location | String | o novo local |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setMyStatus(status)
Define o status do evento (como participante ou convidado) do usuário efetivo.
// 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
status | GuestStatus | o novo status |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.googleapis.com/auth/calendar.readonly
-
https://www.google.com/calendar/feeds
setRecurrence(recurrence, startDate)
Define as regras de recorrência para uma série de eventos de dia inteiro. A aplicação desse método transforma uma série de eventos regulares em uma série de eventos de dia inteiro.
// 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);
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
recurrence | EventRecurrence | as regras de recorrência a serem usadas |
startDate | Date | a data do primeiro evento da série (somente o dia é usado, o horário é ignorado) |
Retorno
CalendarEventSeries
: esta CalendarEventSeries para encadeamento
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setRecurrence(recurrence, startTime, endTime)
Define as regras de recorrência desta série de eventos. Aplicar esse método transforma uma série de eventos de dia inteiro em uma série de eventos regular.
// 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);
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
recurrence | EventRecurrence | as regras de recorrência a serem usadas |
startTime | Date | a data e a hora em que o primeiro evento da série começa |
endTime | Date | a data e a hora em que o primeiro evento da série termina. |
Retorno
CalendarEventSeries
: esta CalendarEventSeries para encadeamento
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setTag(key, value)
Define uma tag de chave-valor no evento para armazenar metadados personalizados.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
key | String | a chave da tag |
value | String | o valor da tag |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setTitle(title)
Define o título do evento.
// 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'); }
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
title | String | o novo título |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds
setVisibility(visibility)
Define a visibilidade do evento.
Parâmetros
Nome | Tipo | Descrição |
---|---|---|
visibility | Visibility |
Retorno
CalendarEventSeries
: este CalendarEventSeries
para encadeamento.
Autorização
Os scripts que usam esse método exigem autorização com um ou mais dos seguintes escopos ou escopos apropriados da API REST relacionada:
-
https://www.googleapis.com/auth/calendar
-
https://www.google.com/calendar/feeds