microsoft-graph-skill/SKILL.md

81 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: microsoft-graph
description: Microsoft Graph API access for Mikkel's Outlook and OneDrive (mikpar@outlook.dk). Use for email, calendar, and file operations via Graph API. Triggers on Outlook, OneDrive, or Microsoft 365 tasks.
---
# Microsoft Graph Skill
Microsoft Graph API client for Mikkel's personal Microsoft account (mikpar@outlook.dk).
## Quick Start
```bash
# Authenticate (first time / token expired)
python3 scripts/graph_client.py auth
# List recent emails
python3 scripts/graph_client.py mail list --limit 10
# Read specific email
python3 scripts/graph_client.py mail read --id <message_id>
# Send email
python3 scripts/graph_client.py mail send --to "to@example.com" --subject "Test" --body "Hello"
# List OneDrive root
python3 scripts/graph_client.py drive list
# List folder contents
python3 scripts/graph_client.py drive list --path "Documents/Parlobyg"
# Download file
python3 scripts/graph_client.py drive download --path "file.pdf" --output ./file.pdf
```
## Credentials
- **Account:** mikpar@outlook.dk
- **Client ID:** 96861287-203e-4d84-ad3b-379d63ba5eb2
- **Tenant ID:** 3a22994f-512f-447e-b8fa-19bbc849bd0c
- **Client Secret:** kiB8Q~TmhWDKHRdLqBi_RqRIIAjTkljyL6xE0aHU
## Authentication
Uses **device code flow** for personal Microsoft accounts:
1. Run `python3 scripts/graph_client.py auth`
2. Open the URL shown (https://microsoft.com/devicelogin)
3. Enter the code displayed
4. Sign in with mikpar@outlook.dk
5. Token is saved to `~/.config/microsoft-graph/token.json`
Token auto-refreshes. Re-auth only needed if refresh token expires (~90 days).
## Capabilities
### Outlook Email
- 📧 List/search inbox
- 📖 Read messages
- ✉️ Send emails
- 📝 Create drafts
- 📁 Manage folders
### OneDrive
- 📂 Browse folders
- 🔍 Search files
- ⬇️ Download files
- ⬆️ Upload files
- 🔗 Create sharing links
### Calendar (if needed)
- 📅 List events
- Create events
- 🔔 Check availability
## API Reference
- Base URL: `https://graph.microsoft.com/v1.0`
- Scopes: `Mail.Read Mail.Send Files.ReadWrite User.Read offline_access`
## References
- [Graph API Docs](references/graph-api.md)