s365b.modules.exchange.tasks

Tasks (Microsoft To Do) of a mailbox.

Read with the To Do API (/users/{id}/todo/lists), which allows reading with an application permission (Tasks.Read.All) but not writing. Each run lists every task of the mailbox’s own lists, with their checklist steps, as Graph’s JSON; the catalog stores only what changed. A task found in none of the lists is a deletion. Moving a task to another list changes its ID (Microsoft’s default for To Do), so its history starts again there: the old task shows as deleted from its list, and both can be restored.

Left out: lists other people share with the mailbox (theirs to back up) and “Flagged email”, which only mirrors flagged messages (backed up with the mail). Restore imports the task’s restore copy (as for mail) into a task folder; see s365b.modules.exchange.restore.

Attributes

Functions

task_lists(ctx, user) → dict[str, str]

The mailbox's own To Do lists: ID → name.

task_metadata(task, list_id) → dict[str, Any]

Fields shown and searched in the browse view.

task_version(task, list_id, path) → s365b.modules.sdk.ItemVersion

The item version for a task.

backup_tasks(ctx, user, lists, saved) → collections.abc.AsyncIterator[s365b.modules.sdk.ItemVersion | s365b.modules.sdk.GroupChange | None]

Back up To Do lists. None means "checkpoint now".

Module Contents

s365b.modules.exchange.tasks.ITEM_TYPE = 'task'[source]
s365b.modules.exchange.tasks.STATE_KEY = 'task_lists'[source]
s365b.modules.exchange.tasks.PAGE = '100'[source]
async s365b.modules.exchange.tasks.task_lists(ctx: s365b.modules.sdk.ModuleContext, user: str) → dict[str, str][source]

The mailbox’s own To Do lists: ID → name.

Parameters:
  • ctx – Module context.

  • user – The mailbox’s user ID.

Returns:

List names by ID.

s365b.modules.exchange.tasks.task_metadata(task: dict[str, Any], list_id: str) → dict[str, Any][source]

Fields shown and searched in the browse view.

Parameters:
  • task – Task from Graph.

  • list_id – Its list.

Returns:

Metadata for the item version.

s365b.modules.exchange.tasks.task_version(task: dict[str, Any], list_id: str, path: str) → s365b.modules.sdk.ItemVersion[source]

The item version for a task.

Parameters:
  • task – The task from Graph.

  • list_id – Its list.

  • path – The list’s name.

Returns:

The version to store.

async s365b.modules.exchange.tasks.backup_tasks(ctx: s365b.modules.sdk.ModuleContext, user: str, lists: dict[str, str], saved: dict[str, Any]) → collections.abc.AsyncIterator[s365b.modules.sdk.ItemVersion | s365b.modules.sdk.GroupChange | None][source]

Back up To Do lists. None means “checkpoint now”.

Parameters:
  • ctx – Module context (with current_items).

  • user – The mailbox’s user ID.

  • lists – The lists now, ID → name.

  • saved – The lists at the last run, ID → name; updated in place.

Yields:

Every task (unchanged ones are recognised by the catalog), deletions, list renames and removals.