domainwidedelegation.comStart free

Use casesScheduling

Automatically colour-code calendar events by rule

Apply consistent event colours for categories like external meetings or focus time by using a delegated service account to update users’ calendars.

Who it is forIT automation teams managing user productivity and calendar hygiene across a domain.
APIsCalendar API
Typical scopescalendar

The problem

Manual event colour-coding is inconsistent and unreliable at scale. Users miss patterns, and visual clutter makes it hard to spot key events or conflicts. Central automation is needed, but must not disrupt user edits.

How it works

  1. Grant the service account domain-wide delegation with calendar scope.
  2. Scan each user's primary calendar for new or updated events matching your rules.
  3. Apply the desired colourId to qualifying events using the Calendar API’s patch method.
  4. Store a marker (e.g., in the event description or extendedProperties) to track processed events and avoid repeat changes.

What changes

Events get colour-coded automatically and consistently, making calendars more readable without burdening users.

The trap in this one. The Calendar API’s event patch is not idempotent with respect to concurrent user edits: if a user changes an event at the same time as automation, one update silently overwrites the other. There is no built-in conflict detection—your automation can easily erase recent user edits (like changed titles or guests) if you do not first fetch the latest event version and reapply all fields. This is especially common when running frequent scans or when users are actively editing their calendars.

Watch it explained

Google Sheets - Use Apps Script to Create Google Calendar Events Automatically” — Eamonn Cottrell on YouTube. Third-party video, included because it covers this ground well. We are not affiliated with the channel.

Questions people ask

Can I use this with shared calendars?

Yes, but you must ensure the service account has access—domain delegation only covers users in the domain, not external shared calendars.

How do I avoid undoing user changes?

Always fetch the latest event just before patching, and only update the colourId or your own marker fields, leaving other fields untouched.

Want this built?

This is a pattern we run in production. We will set up the delegation and build this on top of it — $500 per hour, most of it working the same day.

Talk to us Or read the setup guide

Related use cases

Build a real picture of team availability

Read calendars across the domain to answer who is free, who is overloaded and where the week actually went.

Turn a finished meeting into follow-up automatically

Detect that a meeting happened, pull the notes, and draft the follow-up before anyone opens their laptop.

Turn a booking into a record everywhere it matters

When a meeting is booked, create the record, the folder and the confirmation in one pass.