Le service Agenda avancé vous permet d'utiliser l'API Google Agenda publique dans Apps Script. À l'instar du service Agenda intégré d'Apps Script, cette API autorise les scripts à accéder à l'agenda Google de l'utilisateur et à le modifier, y compris agendas supplémentaires auxquels l'utilisateur est abonné. Dans la plupart des cas, l'API intégrée est plus facile à utiliser, mais ce service avancé offre quelques fonctionnalités supplémentaires y compris la couleur d'arrière-plan de chaque événement.
Référence
Pour en savoir plus sur ce service, consultez le documentation de référence destinée au public API Google Calendar. Comme tous les services avancés d'Apps Script, Le service Agenda utilise les mêmes objets, méthodes et paramètres que le service API. Pour en savoir plus, consultez la section Comment les signatures de méthode sont-elles déterminées.
Pour signaler des problèmes et obtenir de l'aide, consultez les Guide d'assistance Agenda
En-têtes de requête HTTP
Le service Agenda avancé peut accepter les en-têtes de requête HTTP
If-Match
et If-None-Match
. Pour en savoir plus, consultez les
documentation de référence.
Exemple de code
L'exemple de code ci-dessous utilise la version 3 de l'API.
Créer des événements
L'exemple suivant montre comment créer un événement dans l'environnement par défaut Agenda.
Répertorier les agendas
L'exemple suivant montre comment récupérer des informations sur les agendas affiché dans la liste des agendas de l'utilisateur.
Répertorier les événements
L'exemple suivant montre comment répertorier les 10 prochains événements dans l'agenda par défaut de l'utilisateur.
Modifier un événement de manière conditionnelle
L'exemple suivant montre comment mettre à jour un événement Agenda de manière conditionnelle avec
l'en-tête If-Match
. Le script crée un événement, attend 30 secondes, puis
ne met à jour l'événement que si ses détails n'ont pas changé depuis qu'il a été
créé.
Récupérer un événement de manière conditionnelle
L'exemple suivant montre comment récupérer un événement d'agenda de manière conditionnelle avec
l'en-tête If-None-Match
. Le script crée un événement, puis interroge la
pour les modifications pendant 30 secondes. Chaque fois que l'événement change, la nouvelle version
est récupérée.
Synchronisation des événements
L'exemple suivant montre comment récupérer des événements à l'aide de jetons de synchronisation. Lorsque vous incluez un jeton de synchronisation dans une requête de service avancé Agenda, le la réponse obtenue n'inclut que les éléments qui ont été modifiés depuis le jeton généré, ce qui permet un traitement plus efficace. Voir Synchroniser les ressources efficacement pour en savoir plus sur le processus de synchronisation.
L'exemple suivant utilise le même getRelativeDate(daysOffset, hour)
définie dans les exemples ci-dessus.