A Microsoft 365 mail client library for Zig, over Microsoft Graph
README.md
<!-- SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us> SPDX-License-Identifier: MIT --> # zig-o365 A Microsoft 365 mail client for Zig, over Microsoft Graph: folders, messages, the RFC 5322 bytes behind them, and the delta queries that turn a second run into an update rather than another full download. It was pulled out of [allthemail][], where the Office 365 half had been left as a stub — a credentials file, a message listing, and a great deal that was commented out. What is here is that idea finished against the current Graph API, and shaped after its sibling [zig-gmail][], which was extracted from the same project. The OAuth 2.0 half is [zig-oidc][], which this takes a `Client` and a `TokenSet` from and does no signing in of its own. The API documentation is generated from the doc comments — which is where most of the explanation lives — and published at <https://jeff.jcollie.page/zig-o365/>. [allthemail]: https://git.jcollie.dev/jeff/allthemail [zig-gmail]: https://git.jcollie.dev/jeff/zig-gmail [zig-oidc]: https://git.jcollie.dev/jeff/zig-oidc ## What it does - **Folders**, including the whole tree: `folderTree` walks from the root and works out the path of every folder, which is what turns a message's `parentFolderId` into something a person would recognise. - **Messages**, listed with `$select`, `$filter`, `$orderby` and `$search`, and paginated by following `@odata.nextLink` to the end. - **The message itself** — `getMime` fetches `/$value`, which is the RFC 5322 bytes exactly as they arrived. That is what belongs in a maildir; Graph's own `body` is Outlook's rendering of the message rather than the message. - **Delta queries**: the changes to a folder since a stored token, ending with a new token to store. Deletions arrive as tombstones. - **Attachments**, listed without their bytes by default and fetched one at a time when wanted. - **`$batch`**, up to twenty requests per round trip, with the entries a batch reports as throttled retried — which nothing else in the…