| id | ailey-com-outlook |
| name | Outlook Email and Calendar Manager |
| description | Send, read, and manage Outlook/Office 365 emails with attachments and templates. Create and manage calendar events, search contacts, organize folders and rules. Uses Microsoft Graph API. Automatically provides setup instructions when connection fails. |
| keywords | ["outlook","office365","email","calendar","contacts","microsoft-graph","send-email","read-email"] |
| tools | ["microsoft-graph-api","azure-ad","typescript","cli"] |
Outlook Email and Calendar Manager
Comprehensive Outlook and Office 365 integration for email management, calendar events, contacts, and folder organization via Microsoft Graph API.
Overview
This skill provides:
- Email Operations: Send, read, search, delete, move emails with attachments
- Email Templates: Handlebars templates for personalized bulk emails
- Calendar Management: Create, read, update, delete events with Teams meetings
- Contact Management: Search, create, and manage contacts
- Folder Organization: Create and manage mail folders
- Bulk Operations: Send multiple emails with CSV data
- Attachment Handling: Upload and download email attachments
When to Use
Use this skill when:
- Sending emails programmatically from Outlook/Office 365
- Reading and searching mailbox content
- Managing calendar events and meetings
- Automating email workflows
- Bulk email operations with templates
- Integrating Outlook with other tools
- Automatic setup help: Detects connection failures and provides setup instructions
Installation
cd .github/skills/ailey-com-outlook
npm install
Prerequisites:
- Node.js 18+
- Azure AD app registration
- Microsoft Graph API permissions
Quick Start
npm run outlook setup
npm run outlook test
npm run outlook send send -t user@example.com -s "Test" -b "Hello"
npm run outlook read list --folder inbox --top 10
npm run outlook calendar create -s "Meeting" --start "2026-02-01 10:00" --end "2026-02-01 11:00"
npm run outlook contacts search -q "John"
Workflow 1: Send Emails
Send emails with attachments and formatting.
Basic Email
npm run outlook send send \
-t user@example.com \
-s "Project Update" \
-b "The project is on track."
npm run outlook send send \
-t user@example.com \
-s "Report" \
-b "<h1>Q1 Results</h1><p>Revenue: $1M</p>" \
--html
npm run outlook send send \
-t user@example.com \
--cc manager@example.com \
--bcc tracking@example.com \
-s "Status Update" \
-b "Project status attached."
npm run outlook send send \
-t user@example.com \
-s "Documentation" \
--file email-body.txt
With Attachments
npm run outlook send send \
-t user@example.com \
-s "Report" \
-b "See attached report." \
--attach report.pdf
npm run outlook send send \
-t user@example.com \
-s "Files" \
-b "See attachments." \
--attach "doc1.pdf,doc2.xlsx,presentation.pptx"
Template Emails
cat > templates/welcome.hbs << 'EOF'
<h1>Welcome {{name}}!</h1>
<p>Thank you for joining {{company}}.</p>
<p>Your account details:</p>
<ul>
<li>Username: {{username}}</li>
<li>Email: {{email}}</li>
</ul>
EOF
cat > data.json << 'EOF'
{
"name": "John Doe",
"company": "Acme Corp",
"username": "jdoe",
"email": "jdoe@example.com"
}
EOF
npm run outlook send template \
-t jdoe@example.com \
--template templates/welcome.hbs \
--data data.json \
-s "Welcome to {{company}}"
Bulk Emails
cat > recipients.csv << 'EOF'
email,name,subject,body
john@example.com,John,Hello John,Welcome to the team
jane@example.com,Jane,Hello Jane,Welcome to the team
EOF
npm run outlook send bulk \
--csv recipients.csv \
--delay 2000
npm run outlook send bulk \
--csv recipients.csv \
--template templates/welcome.hbs \
--attach onboarding.pdf
TypeScript API
import { OutlookClient } from './scripts/outlook-client.js';
const client = new OutlookClient();
await client.sendEmail({
to: 'user@example.com',
subject: 'Test',
body: 'Hello!',
attachments: ['file.pdf'],
isHtml: false,
});
await client.sendEmail({
to: ['user1@example.com', 'user2@example.com'],
cc: ['manager@example.com'],
subject: 'Team Update',
body: '<h1>Update</h1>',
isHtml: true,
});
Workflow 2: Read and Search Emails
Read mailbox content with filtering and search.
List Emails
npm run outlook read list
npm run outlook read list --folder sent
npm run outlook read list --folder drafts
npm run outlook read list --from boss@example.com
npm run outlook read list --subject "invoice"
npm run outlook read list --unread
npm run outlook read list --attachments
npm run outlook read list --top 20
npm run outlook read list --format json -o emails.json
View Email Details
npm run outlook read show -i MESSAGE_ID
npm run outlook read show \
-i MESSAGE_ID \
--save-attachments ./downloads/
Manage Emails
npm run outlook read mark -i MESSAGE_ID
npm run outlook read mark -i MESSAGE_ID --unread
npm run outlook read delete -i MESSAGE_ID --confirm
npm run outlook read move -i MESSAGE_ID --to FOLDER_ID
TypeScript API
const emails = await client.readEmails({
folder: 'inbox',
from: 'boss@example.com',
subject: 'urgent',
isRead: false,
hasAttachments: true,
top: 10,
});
const email = await client.getEmail(messageId);
await client.downloadAttachment(
messageId,
attachmentId,
'./downloads/file.pdf'
);
await client.markAsRead(messageId, true);
await client.deleteEmail(messageId);
Workflow 3: Calendar Management
Create and manage calendar events with Teams meetings.
Create Events
npm run outlook calendar create \
-s "Team Meeting" \
--start "2026-02-01 10:00" \
--end "2026-02-01 11:00"
npm run outlook calendar create \
-s "Client Meeting" \
--start "2026-02-01 14:00" \
--end "2026-02-01 15:00" \
-l "Conference Room A"
npm run outlook calendar create \
-s "Project Review" \
--start "2026-02-01 09:00" \
--end "2026-02-01 10:00" \
--attendees "john@example.com,jane@example.com"
npm run outlook calendar create \
-s "Virtual Standup" \
--start "2026-02-01 09:00" \
--end "2026-02-01 09:30" \
--online
List Events
npm run outlook calendar list
npm run outlook calendar list \
--start 2026-02-01 \
--end 2026-02-28
npm run outlook calendar list --days 14
Manage Events
npm run outlook calendar show -i EVENT_ID
npm run outlook calendar update \
-i EVENT_ID \
-s "Updated Title" \
-l "New Location"
npm run outlook calendar delete -i EVENT_ID --confirm
TypeScript API
const event = await client.createEvent({
subject: 'Team Meeting',
start: new Date('2026-02-01T10:00:00'),
end: new Date('2026-02-01T11:00:00'),
location: 'Room A',
attendees: ['user@example.com'],
isOnline: true,
});
const events = await client.listEvents(
new Date('2026-02-01'),
new Date('2026-02-28')
);
await client.updateEvent(eventId, {
subject: 'New Title',
location: 'New Location',
});
await client.deleteEvent(eventId);
Workflow 4: Contact Management
Search and manage contacts.
Search Contacts
npm run outlook contacts search -q "John"
npm run outlook contacts search -q "example.com" --format json
Create Contacts
npm run outlook contacts create \
-n "John Doe" \
-e john@example.com
npm run outlook contacts create \
-n "Jane Smith" \
-e jane@example.com \
-p "+1-555-0100" \
-j "Senior Manager" \
-c "Acme Corp"
Manage Contacts
npm run outlook contacts show -i CONTACT_ID
npm run outlook contacts delete -i CONTACT_ID --confirm
TypeScript API
const contacts = await client.searchContacts('John');
const contact = await client.createContact({
displayName: 'John Doe',
emailAddress: 'john@example.com',
phoneNumber: '+1-555-0100',
jobTitle: 'Developer',
company: 'Acme',
});
await client.deleteContact(contactId);
Workflow 5: Folder Management
Organize emails with folders.
List Folders
npm run outlook folders list
Create Folders
npm run outlook folders create -n "Projects"
npm run outlook folders create \
-n "2026 Projects" \
--parent PARENT_FOLDER_ID
Delete Folders
npm run outlook folders delete -i FOLDER_ID --confirm
TypeScript API
const folders = await client.listFolders();
const folder = await client.createFolder('Projects');
const subfolder = await client.createFolder(
'2026',
parentFolderId
);
await client.deleteFolder(folderId);
Advanced Usage
Environment Configuration
Priority: .env.local > .env > ~/.vscode/.env
AZURE_TENANT_ID=your-tenant-id
AZURE_CLIENT_ID=your-client-id
AZURE_CLIENT_SECRET=your-client-secret
Authentication Types
App-only (Service/Daemon):
AZURE_CLIENT_SECRET=your-secret
User delegation (Interactive):
Error Handling
try {
await client.sendEmail(options);
} catch (error) {
if (error.message.includes('credentials')) {
console.error('Setup required. Run: npm run outlook setup');
} else if (error.message.includes('permissions')) {
console.error('Missing API permissions');
} else {
console.error('Error:', error);
}
}
Integration
With ailey-tools-tag-n-rag
Index email content:
npm run outlook read list --format json -o emails.json
npm run rag tag -i emails.json -t "email,work" -c "Email Archive"
CI/CD Email Notifications
- name: Send build notification
run: |
cd .github/skills/ailey-com-outlook
npm run outlook send send \
-t team@example.com \
-s "Build ${{ github.run_number }} complete" \
-b "Status: ${{ job.status }}"
Troubleshooting
Connection Failures
Automatic Help:
npm run outlook test
Manual Setup:
npm run outlook setup
Permission Errors
Required Microsoft Graph permissions:
Mail.Read - Read emails
Mail.ReadWrite - Manage emails
Mail.Send - Send emails
Calendars.ReadWrite - Manage calendar
Contacts.ReadWrite - Manage contacts
Common Issues
Issue: credentials not found
Solution:
echo $AZURE_TENANT_ID
echo $AZURE_CLIENT_ID
vim ~/.vscode/.env
Issue: Rate limit exceeded
Solution: Add delays between bulk operations:
npm run outlook send bulk --csv file.csv --delay 2000
Best Practices
- API Limits: Respect Microsoft Graph rate limits (use delays for bulk)
- Templates: Use Handlebars for personalized emails
- Attachments: Keep under 4 MB per attachment
- Security: Store credentials in environment files, not code
- Error Handling: Always check connection before bulk operations
References
version: 1.0.0
updated: 2026-01-31
reviewed: 2026-01-31
score: 4.6