The Kladde knows appointments: title, start, end, contacts, with rules (quarter hours, end after start, at most eight hours, no overlap). But the office lives in Outlook, and there are things there that the Kladde does not know: vacation, the dentist, the walk-through at the customer's. In this lesson you learn the half of the way that Graph offers for this: reading and writing calendars. The synchronization in both directions, with changes, conflicts and deletions, follows in the next lesson; here the foundation it stands on is built.

Not run against a tenant. As in the lesson before: No call in this lesson was run against a Microsoft 365 tenant. Addresses, properties, limits and code examples come from Microsoft Learn, read for this lesson. Where a response of the service would have to be shown, there is a description. What Learn leaves open appears as “not read” or “open” in the text, and the exercises with a tenant say so and have a part without a tenant.

Part What gets built
Decision Application or delegated: why the Kladde's sync runs as an application, limited to one mailbox
Reading calendarView, time zone, series, exceptions; our own interface IOfficeCalendar
Mapping AppointmentMapper: Kladde appointment ⇄ event, without contact data
Writing Create, change, delete with the SDK; transactionId, link table, OfficeCalendarWriter
Free or busy getSchedule, availabilityView, the connection to the free times from lesson 2.11.4

Where the Kladde stands

From K2 and the last lesson you need:

  • Appointment in the core with Id, Title, Time (start and end as DateTimeOffset) and ContactIds, plus the AppointmentPlanner with the rules and the error code appointment.time.overlaps (lesson 2.11.3, “Milestone 2: Appointments in the office”). The API's response, AppointmentResponse(Title, Start, End, ContactIds), has no Id (lesson 2.3.3); for the sync we therefore work with Appointment itself, not with the response.
  • time on the web: instants with an offset, the office's time zone as output, never as a storage format (lesson 2.3.9, “Time on the web”).
  • the free-times calculation FreeSlots and the booking (lesson 2.11.4, “Milestone 3: Free times and booking”).
  • the outbox with OutboxMessage, IOutboxDelivery and DeliveryOutcome (lesson 2.8.4), the background service (lesson 2.8.2) and the project Kladde.Graph along with the exception GraphCallException from lesson W4.2.1.

Again the module's rule applies: The core owns its interfaces, the SDK stands behind them. The core gets a folder Kladde.Core/Calendar with the types of this lesson, Kladde.Graph gets the implementation.