Logo Outlook Automation

Outlook Automation

Cộng đồng
tamirdresher
outlook-automation

Control Microsoft Outlook on Windows via COM automation. Use when the user wants to create meetings, send emails, search emails, read inbox, manage calendar events, or interact with Outlook in any way. Triggers on phrases like "create meeting", "send email", "search emails", "check inbox", "calendar", "schedule", "outlook".

Tổng quan

Nhà phát hànhtamirdresher
Kho mãsquad-skills
Tên kỹ năngoutlook-automation
Sao
44
Bản fork
9
Tệp đi kèm
2
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 2 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được tamirdresher công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Outlook Automation trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/tamirdresher/squad-skills/tree/main/plugins/outlook-automation
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/tamirdresher/squad-skills.git /tmp/squad-skills
mkdir -p .claude/skills
cp -r /tmp/squad-skills/plugins/outlook-automation .claude/skills/outlook-automation
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Outlook Automation trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Outlook Automation ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Outlook Automation với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Outlook Automation (Windows COM)

When to Use

  • User wants to create, update, or delete calendar meetings/appointments
  • User wants to send, read, search, or manage emails
  • User wants to interact with Outlook contacts, folders, or tasks
  • Any request involving Outlook data or actions on Windows

When Not to Use

  • User is on macOS or Linux (COM is Windows-only)
  • User wants cloud-only access without local Outlook installed (use Microsoft Graph API instead)
  • Outlook is not installed on the machine

Prerequisites

  • Windows with Microsoft Outlook installed and configured with an account
  • PowerShell (available by default)

Core Concepts

Outlook COM exposes these key object types:

OlItemType ValueTypeDescription
0MailItemEmail messages
1AppointmentItemCalendar events / meetings
2ContactItemContacts
3TaskItemTasks
4JournalItemJournal entries
6NoteItemNotes

Folder Constants (OlDefaultFolders)

ValueFolder
3olFolderDeletedItems
4olFolderOutbox
5olFolderSentMail
6olFolderInbox
9olFolderCalendar
10olFolderContacts
13olFolderDrafts
28olFolderToDo

Meeting Status Constants (OlMeetingStatus)

ValueStatus
0olNonMeeting (appointment, no attendees)
1olMeeting (meeting with attendees)
3olMeetingReceived
5olMeetingCanceled

Workflow

Initialization

Always start by creating the COM object:

powershell
$outlook = New-Object -ComObject Outlook.Application
$namespace = $outlook.GetNameSpace("MAPI")

Get the current user's email

powershell
$currentUser = $namespace.CurrentUser
$currentUserEmail = $namespace.Accounts.Item(1).SmtpAddress
Write-Host "Logged in as: $currentUserEmail"

Email Operations

Send an Email

powershell
$mail = $outlook.CreateItem(0)
$mail.Subject = "Subject here"
$mail.Body = "Plain text body here"
# For HTML body use: $mail.HTMLBody = "<h1>Hello</h1><p>HTML content</p>"
$mail.To = "recipient@example.com"
# $mail.CC = "cc@example.com"
# $mail.BCC = "bcc@example.com"

# Add attachment (optional):
# $mail.Attachments.Add("C:\path\to\file.pdf")

$mail.Send()
Write-Host "Email sent successfully"

Read Inbox Emails

powershell
$inbox = $namespace.GetDefaultFolder(6)
$messages = $inbox.Items
$messages.Sort("[ReceivedTime]", $true)  # Sort newest first

# Get last N emails
$count = [Math]::Min(10, $messages.Count)
for ($i = 1; $i -le $count; $i++) {
    $msg = $messages.Item($i)
    Write-Host "---"
    Write-Host "From: $($msg.SenderEmailAddress)"
    Write-Host "Subject: $($msg.Subject)"
    Write-Host "Received: $($msg.ReceivedTime)"
    Write-Host "Unread: $($msg.UnRead)"
}

Search Emails

Use the Restrict method with DASL or Jet query filters:

powershell
$inbox = $namespace.GetDefaultFolder(6)

# Search by subject (contains)
$filter = "@SQL=""urn:schemas:httpmail:subject"" LIKE '%search term%'"
$results = $inbox.Items.Restrict($filter)

# Search by sender
$filter = "@SQL=""urn:schemas:httpmail:fromemail"" = 'sender@example.com'"
$results = $inbox.Items.Restrict($filter)

# Search by date range
$startDate = (Get-Date).AddDays(-7).ToString("MM/dd/yyyy HH:mm")
$filter = "[ReceivedTime] >= '$startDate'"
$results = $inbox.Items.Restrict($filter)

# Search unread only
$filter = "[UnRead] = True"
$results = $inbox.Items.Restrict($filter)

# Combine filters with AND/OR
$filter = "@SQL=""urn:schemas:httpmail:subject"" LIKE '%project%' AND ""urn:schemas:httpmail:hasattachment"" = 1"
$results = $inbox.Items.Restrict($filter)

foreach ($item in $results) {
    Write-Host "$($item.ReceivedTime) | $($item.SenderEmailAddress) | $($item.Subject)"
}
Write-Host "Found $($results.Count) matching emails"

Reply / Forward

powershell
$inbox = $namespace.GetDefaultFolder(6)
$email = $inbox.Items.GetFirst()

# Reply
$reply = $email.Reply()
$reply.Body = "Reply text`n" + $reply.Body
$reply.Send()

# Reply All
$replyAll = $email.ReplyAll()
$replyAll.Body = "Reply all text`n" + $replyAll.Body
$replyAll.Send()

# Forward
$fwd = $email.Forward()
$fwd.To = "someone@example.com"
$fwd.Body = "FYI`n" + $fwd.Body
$fwd.Send()

Calendar Operations

Create an Appointment (no attendees)

powershell
$appt = $outlook.CreateItem(1)
$appt.Subject = "My Appointment"
$appt.Body = "Description here"
$appt.Start = [DateTime]"2026-03-15 10:00"
$appt.Duration = 60  # minutes
$appt.Location = "Room 101"
$appt.ReminderSet = $true
$appt.ReminderMinutesBeforeStart = 15
$appt.Save()
Write-Host "Appointment created: $($appt.Subject) at $($appt.Start)"

Create a Meeting (with attendees)

powershell
$meeting = $outlook.CreateItem(1)
$meeting.MeetingStatus = 1  # olMeeting
$meeting.Subject = "Team Sync"
$meeting.Body = "Weekly sync meeting"
$meeting.Start = [DateTime]"2026-03-15 14:00"
$meeting.Duration = 30
$meeting.Location = "Conference Room A"

# Add required attendees
$meeting.Recipients.Add("attendee1@example.com")
$meeting.Recipients.Add("attendee2@example.com")

# Add optional attendee
$optionalAttendee = $meeting.Recipients.Add("optional@example.com")
$optionalAttendee.Type = 2  # olOptional (1=Required, 2=Optional, 3=Resource)

$meeting.Recipients.ResolveAll()

$meeting.Send()  # Use .Save() to save without sending invites
Write-Host "Meeting invitation sent: $($meeting.Subject)"

Create a Recurring Meeting

powershell
$meeting = $outlook.CreateItem(1)
$meeting.Subject = "Daily Standup"
$meeting.Start = [DateTime]"2026-03-16 09:00"
$meeting.Duration = 15

$recurrence = $meeting.GetRecurrencePattern()
$recurrence.RecurrenceType = 1  # 0=Daily, 1=Weekly, 2=Monthly, 3=MonthNth, 5=Yearly
$recurrence.Interval = 1
$recurrence.DayOfWeekMask = 62  # Mon-Fri (2+4+8+16+32)
$recurrence.PatternStartDate = [DateTime]"2026-03-16"
$recurrence.PatternEndDate = [DateTime]"2026-06-30"

$meeting.Save()
Write-Host "Recurring meeting created"

List Upcoming Calendar Events

powershell
$calendar = $namespace.GetDefaultFolder(9)
$items = $calendar.Items
$items.Sort("[Start]")
$items.IncludeRecurrences = $true

$startDate = (Get-Date).ToString("MM/dd/yyyy")
$endDate = (Get-Date).AddDays(7).ToString("MM/dd/yyyy")
$filter = "[Start] >= '$startDate' AND [Start] <= '$endDate'"
$upcoming = $items.Restrict($filter)

foreach ($event in $upcoming) {
    Write-Host "$($event.Start) - $($event.End) | $($event.Subject) | $($event.Location)"
}

Find and Modify a Meeting

powershell
$calendar = $namespace.GetDefaultFolder(9)
$filter = "@SQL=""urn:schemas:httpmail:subject"" = 'Team Sync'"
$found = $calendar.Items.Restrict($filter)

if ($found.Count -gt 0) {
    $meeting = $found.GetFirst()
    $meeting.Start = [DateTime]"2026-03-15 15:00"  # Reschedule
    $meeting.Duration = 45
    $meeting.Save()  # or $meeting.Send() to notify attendees
    Write-Host "Meeting updated"
}

Delete/Cancel a Meeting

powershell
$calendar = $namespace.GetDefaultFolder(9)
$filter = "[Subject] = 'Team Sync'"
$found = $calendar.Items.Restrict($filter)

if ($found.Count -gt 0) {
    $meeting = $found.GetFirst()
    $meeting.Delete()
    Write-Host "Meeting deleted"
}

Contact Operations

Create a Contact

powershell
$contact = $outlook.CreateItem(2)
$contact.FullName = "John Doe"
$contact.Email1Address = "john.doe@example.com"
$contact.BusinessTelephoneNumber = "+1-555-0100"
$contact.CompanyName = "Contoso"
$contact.JobTitle = "Engineer"
$contact.Save()

Search Contacts

powershell
$contacts = $namespace.GetDefaultFolder(10)
$filter = "[FullName] = 'John Doe'"
$results = $contacts.Items.Restrict($filter)
foreach ($c in $results) {
    Write-Host "$($c.FullName) - $($c.Email1Address)"
}

Task Operations

Create a Task

powershell
$task = $outlook.CreateItem(3)
$task.Subject = "Review PR #42"
$task.Body = "Review and approve the pull request"
$task.DueDate = (Get-Date).AddDays(2)
$task.Importance = 2  # 0=Low, 1=Normal, 2=High
$task.Save()

Folder Operations

List All Folders

powershell
function List-OutlookFolders($folder, $indent = 0) {
    $prefix = " " * $indent
    Write-Host "$prefix$($folder.Name) ($($folder.Items.Count) items)"
    foreach ($subfolder in $folder.Folders) {
        List-OutlookFolders $subfolder ($indent + 2)
    }
}

$root = $namespace.Folders
foreach ($store in $root) {
    List-OutlookFolders $store
}

Move Email to Folder

powershell
$inbox = $namespace.GetDefaultFolder(6)
$targetFolder = $inbox.Folders.Item("Archive")  # subfolder of Inbox
$email = $inbox.Items.GetFirst()
$email.Move($targetFolder)

Tips and Error Handling

  • Security prompts: Outlook may show security dialogs when accessing certain properties (like .Body of emails from external senders). This is by design.
  • COM cleanup: After heavy COM usage, release objects:
    powershell
    [System.Runtime.InteropServices.Marshal]::ReleaseComObject($outlook) | Out-Null
  • Outlook must be running: The COM object connects to a running Outlook instance or starts one. Ensure Outlook is configured with an account.
  • Date formats: Use the system's date format or explicit [DateTime] casting to avoid locale issues.
  • Large mailboxes: Use .Restrict() filters instead of iterating all items for performance.
  • Error handling pattern:
    powershell
    try {
        $outlook = New-Object -ComObject Outlook.Application
        # ... operations ...
    } catch {
        Write-Error "Outlook COM error: $_"
    }

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Outlook Automation làm được gì?

Control Microsoft Outlook on Windows via COM automation. Use when the user wants to create meetings, send emails, search emails, read inbox, manage calendar events, or interact with Outlook in any way. Triggers on phrases like "create meeting", "send email", "search emails", "check inbox", "calendar", "schedule", "outlook".

Vì sao nên dùng Outlook Automation trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Outlook Automation là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Outlook Automation trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/tamirdresher/squad-skills/tree/main/plugins/outlook-automation. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Outlook Automation?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Outlook Automation với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Outlook Automation với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Outlook Automation có miễn phí không?

Có. Kỹ năng này được tamirdresher phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇