AgentSkillsCN

outlook-contacts

通过 PowerShell 管理 Outlook 联系人:列出、创建、搜索、更新、删除联系人,添加/移除照片,并以 vCard 格式导出。此功能需 Outlook 处于运行状态。

SKILL.md
--- frontmatter
name: outlook-contacts
description: "Manage Outlook contacts via PowerShell: list, create, search, update, delete contacts, add/remove photos, and export as vCard. Requires Outlook running."

Outlook Contacts

Manage Microsoft Outlook contacts using PowerShell COM objects.

Prerequisites

  • Microsoft Outlook installed and running
  • PowerShell 5.1+ (included in Windows 10/11)

List Contacts

outlook-contacts-list.ps1

Browse contacts with optional search filtering. Returns EntryIDs for use with action scripts.

Required Parameters: None (lists all contacts by default)

ParameterTypeDefaultDescription
-Limitint20Maximum contacts to display
-SearchstringFilter by name, email, or company (case-insensitive)
powershell
# List all contacts (first 20)
& "./scripts/outlook-contacts-list.ps1" -Limit 20

# List with search filter
& "./scripts/outlook-contacts-list.ps1" -Search "John"

Search Contacts

outlook-contacts-search.ps1

Search contacts by name, email, and/or company. Multiple criteria use AND logic. Returns EntryIDs for use with action scripts.

Required Parameters: At least one of -Name, -Email, or -Company

ParameterTypeDefaultDescription
-NamestringSearch by contact name (case-insensitive contains)
-EmailstringSearch by email address (case-insensitive contains)
-CompanystringSearch by company name (case-insensitive contains)
-Limitint10Maximum results to return
powershell
# Search by name
& "./scripts/outlook-contacts-search.ps1" -Name "John"

# Search by company
& "./scripts/outlook-contacts-search.ps1" -Company "Acme"

# Search by email domain
& "./scripts/outlook-contacts-search.ps1" -Email "example.com"

# Combined search (AND logic)
& "./scripts/outlook-contacts-search.ps1" -Name "John" -Company "Acme"

Create Contact

outlook-contacts-create.ps1

Create a new contact in the default Contacts folder.

Required Parameters: -FullName

ParameterTypeDefaultDescription
-FullNamestringRequiredContact's full name
-EmailstringEmail address
-PhonestringBusiness phone number
-MobilestringMobile phone number
-HomePhonestringHome phone number
-CompanystringCompany name
-JobTitlestringJob title
-NotesstringNotes/body text
powershell
# Create a new contact
& "./scripts/outlook-contacts-create.ps1" -FullName "John Doe" -Email "john@example.com" -Phone "555-1234" -Company "Acme Inc" -JobTitle "Manager"

# Create with mobile and notes
& "./scripts/outlook-contacts-create.ps1" -FullName "Jane Smith" -Email "jane@example.com" -Mobile "555-5678" -Notes "Met at conference"

Update Contact

outlook-contacts-update.ps1

Edit an existing contact's fields. Uses EntryID (preferred) or Index as targeting method.

Required Parameters: -EntryID or -Index, plus at least one field to update

ParameterTypeDefaultDescription
-EntryIDstringContact's unique EntryID (preferred, from list/search)
-Indexint0Contact position number (fallback)
-FullNamestringNew full name
-EmailstringNew email address
-PhonestringNew business phone
-MobilestringNew mobile phone
-CompanystringNew company name
-JobTitlestringNew job title
-NotesstringNew notes/body text
-SearchstringFilter contacts before applying Index (narrows list)
powershell
# Update by EntryID (preferred)
& "./scripts/outlook-contacts-update.ps1" -EntryID "00000000..." -Email "newemail@example.com"

# Update by index
& "./scripts/outlook-contacts-update.ps1" -Index 1 -Phone "555-9999" -Company "New Corp"

# Update with search filter
& "./scripts/outlook-contacts-update.ps1" -Index 1 -Search "John" -JobTitle "Director"

Contact Photo

outlook-contacts-photo.ps1

Add or remove a contact's photo. Supports JPG, JPEG, PNG, GIF, BMP formats.

Required Parameters: -EntryID or -Index, plus -PhotoPath or -Remove

ParameterTypeDefaultDescription
-EntryIDstringContact's unique EntryID (preferred)
-Indexint0Contact position number (fallback)
-PhotoPathstringPath to photo file (JPG, PNG, GIF, BMP)
-RemoveswitchfalseRemove existing photo instead of adding
-SearchstringFilter contacts before applying Index
powershell
# Add photo by EntryID
& "./scripts/outlook-contacts-photo.ps1" -EntryID "00000000..." -PhotoPath "C:\Photos\john.jpg"

# Add photo by index
& "./scripts/outlook-contacts-photo.ps1" -Index 1 -PhotoPath "C:\Photos\john.jpg"

# Remove photo
& "./scripts/outlook-contacts-photo.ps1" -EntryID "00000000..." -Remove

Export Contact

outlook-contacts-export.ps1

Export a contact as vCard (.vcf) file. Default save location is Downloads folder.

Required Parameters: -EntryID or -Index

ParameterTypeDefaultDescription
-EntryIDstringContact's unique EntryID (preferred)
-Indexint0Contact position number (fallback)
-Pathstring~/DownloadsSave path (file or directory)
-SearchstringFilter contacts before applying Index
powershell
# Export by EntryID
& "./scripts/outlook-contacts-export.ps1" -EntryID "00000000..."

# Export to specific path
& "./scripts/outlook-contacts-export.ps1" -EntryID "00000000..." -Path "C:\Contacts\john.vcf"

# Export by index
& "./scripts/outlook-contacts-export.ps1" -Index 1

Delete Contact

outlook-contacts-delete.ps1

Delete a contact from Outlook. Supports targeting by EntryID (preferred), Index, or Name.

Required Parameters: One of -EntryID, -Index, or -Name

ParameterTypeDefaultDescription
-EntryIDstringContact's unique EntryID (preferred)
-Indexint0Contact position number (fallback)
-NamestringExact full name match (fallback)
powershell
# Delete by EntryID (preferred)
& "./scripts/outlook-contacts-delete.ps1" -EntryID "00000000..."

# Delete by index
& "./scripts/outlook-contacts-delete.ps1" -Index 1

# Delete by name
& "./scripts/outlook-contacts-delete.ps1" -Name "John Doe"