The Kladde's appointments now sit in the office's calendar. But the office uses Outlook, and Outlook changes: someone drags an appointment to a new time, deletes one, enters a vacation that the Kladde cannot know about. This lesson builds the way back: changes from Outlook come into the Kladde, without reading the whole calendar every time, without duplicates, and without the Kladde and Outlook writing back and forth to each other until somebody pulls the plug.
Graph offers two tools for this, and the lesson combines them: delta queries answer "What has changed since my last look?", and change notifications say "Something has changed." Learn describes how they work together in one sentence: An app can subscribe to notifications and then use delta to fetch all changes since the last query. That is the plan. The rest is the question of what happens when something goes wrong.
Not run against a tenant. No call in this lesson ran against a Microsoft 365 tenant. Addresses, properties, deadlines and limits come from Microsoft Learn, read for this lesson; responses of the service are described, not demonstrated. Where Learn leaves a question open, it says "not read" or "open". Every exercise with a tenant says so and has a part that runs without a tenant: Here that is most of them, because the rules of the synchronization are pure logic behind our own interfaces.
| Part | What gets built |
|---|---|
| Rules | who wins, what happens on deletion, how echoes are recognized: seven rules that the code and the tests pin down |
| Delta | IOfficeCalendarDelta, the round made of pages, nextLink and deltaLink, the window, the expired token |
| Applying | ChangeApplier: one change, the rules, idempotent; CalendarSync: one round |
| Notification | subscription, webhook, validation, clientState, renewal, lifecycle events |
| Operation | CalendarSyncService: nudge by notification, safety net by timer, tests with FakeTimeProvider |
Where the Kladde stands
From lesson W4.2.2 you have IOfficeCalendar with OfficeEvent, OfficeCalendarWriter (creates and changes), ICalendarLinks (the Kladde's appointment ⇄ event) and AvailabilityView. From K2: the outbox (lesson 2.8.4, "The outbox pattern"), the background service
with a start delay and a scope per run (lesson 2.8.2, "Background services"), AppointmentPlanner with MoveAsync and the rules for appointments (lesson 2.11.3, "Milestone 2: Appointments in the office") and FakeTimeProvider (lesson 2.8.2).