s365b.modules.exchange.ics ========================== .. py:module:: s365b.modules.exchange.ics .. autoapi-nested-parse:: iCalendar (``.ics``) export of backed-up events and tasks. Events become ``VEVENT`` and tasks ``VTODO`` components (RFC 5545), which Outlook, Apple Calendar, Google Calendar and Thunderbird import. Graph stores times in UTC (``Prefer: outlook.timezone`` is not sent), with the zone the organizer used (``originalStartTimeZone``, usually a Windows name such as "Pacific Standard Time"). Times are written in that zone, as an IANA name with its ``VTIMEZONE``, so a weekly 09:00 meeting stays at 09:00 across daylight saving time. All-day events and due dates are plain dates. Not in the export: single occurrences of a recurring meeting that were changed or cancelled (Graph's backup has the series only), attachments, and To Do checklist steps as separate items (they are listed in the description). Attributes ---------- .. autoapisummary:: s365b.modules.exchange.ics.PRODID s365b.modules.exchange.ics.DAYS s365b.modules.exchange.ics.POSITION s365b.modules.exchange.ics.PARTSTAT s365b.modules.exchange.ics.ROLE s365b.modules.exchange.ics.TODO_STATUS s365b.modules.exchange.ics.PRIORITY Functions --------- .. autoapisummary:: s365b.modules.exchange.ics.zone s365b.modules.exchange.ics.rrule s365b.modules.exchange.ics.event_component s365b.modules.exchange.ics.task_component s365b.modules.exchange.ics.to_ics Module Contents --------------- .. py:data:: PRODID :value: '-//Mail Safehouse//Backup export//EN' .. py:data:: DAYS .. py:data:: POSITION .. py:data:: PARTSTAT .. py:data:: ROLE .. py:data:: TODO_STATUS .. py:data:: PRIORITY .. py:function:: zone(name: str | None) -> zoneinfo.ZoneInfo The IANA zone for a Graph time zone name (Windows or IANA); UTC if unknown. :param name: E.g. "Pacific Standard Time" or "Europe/Paris". :returns: The zone. .. py:function:: rrule(recurrence: dict[str, Any] | None, start: datetime.datetime | datetime.date) -> dict[str, Any] | None A Graph ``patternedRecurrence`` as an iCalendar ``RRULE``. :param recurrence: The recurrence from Graph. :param start: The first occurrence (a date for all-day events and tasks). :returns: The rule's parts, or ``None`` if there is no (supported) recurrence. .. py:function:: event_component(event: dict[str, Any]) -> icalendar.Event A backed-up event as a ``VEVENT``. :param event: The event as Graph returned it. :returns: The component. .. py:function:: task_component(task: dict[str, Any]) -> icalendar.Todo A backed-up To Do task as a ``VTODO``. :param task: The task as Graph returned it (with ``checklistItems`` if any). :returns: The component. .. py:function:: to_ics(items: list[tuple[str, dict[str, Any]]], name: str | None = None) -> bytes Events and tasks as one iCalendar file. :param items: ``(item type, Graph JSON)`` pairs; types other than ``event`` and ``task`` are left out. :param name: Calendar name shown by some programs (e.g. the calendar's). :returns: The ``.ics`` file.