Microsoft Graph API client library for Rust
This library is composed of 3 feature-gated layers:
- Low-level I/O-free coroutines: no_std-compatible state machines containing the whole Microsoft Graph REST logic, usable anywhere
- Mid-level light client: a standard, blocking client wrapping a stream you opened yourself
- High-level full client: the light client plus TCP connections and TLS negotiations handled for you
- I/O-free coroutines: state machines with no socket, no async runtime and no forced I/O model; run them from any blocking, async or test harness.
- Mail surface: manage mail folders, messages and attachments, download raw MIME content, create drafts from JSON or MIME and send them, with incremental change tracking through delta queries (see API coverage).
- Contacts surface: manage contact folders and contacts, with three-state update fields distinguishing a cleared field from a preserved one, and incremental change tracking through delta queries.
- Bearer-token authentication: requests carry the OAuth 2.0 access token you provide; minting and refreshing it stays under your control.
- Light client: a standard, blocking client exposing one method per operation over a stream you opened yourself (requires
clientfeature). - Full client with TLS support:
- Rustls with ring crypto (requires
rustls-ringfeature, enabled by default) - Rustls with aws crypto (requires
rustls-awsfeature) - Native TLS (requires
native-tlsfeature)
- Rustls with ring crypto (requires
Tip
I/O Microsoft Graph is written in Rust and uses cargo features to gate the client layers. The default feature set is declared in Cargo.toml or on docs.rs.
Microsoft Graph is a single API spanning many domains; io-msgraph covers it incrementally, mirroring the Microsoft Graph v1.0 reference. Every operation below is an I/O-free coroutine; the calendar domain is planned next.
| Resource | Operations |
|---|---|
| users | get the signed-in user profile; sendMail action (JSON and MIME form) |
| users.mailFolders | list, get, create, update, delete, move, copy, list child folders |
| users.messages | list, get, get raw MIME, create draft from JSON or MIME, update, delete, move, copy, send, track changes with delta |
| users.messages.attachments | list, create, get raw content, delete |
| users.contactFolders | list, get, create, update, delete, list child folders |
| users.contacts | list, get, create, update, delete, track changes with delta |
See documentation at docs.rs.
See complete examples at ./tests.
Have also a look at real-world projects built on top of this library:
- Himalaya CLI: CLI to manage emails
- Cardamum CLI: CLI to manage contacts
This project is licensed under either of:
- Chat on Matrix
- News on Mastodon or RSS
- Mail at pimalaya.org@posteo.net
Special thanks to the NLnet foundation and the European Commission that have been financially supporting the project for years:
- 2022 → 2023: NGI Assure
- 2023 → 2024: NGI Zero Entrust
- 2024 → 2026: NGI Zero Core
- 2026 → 2027: NGI Zero Commons Fund
This program is part of Pimalaya, free software funded entirely by grants and donations. If you find it useful, consider sponsoring its development:
