CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-exchangelib

Client for Microsoft Exchange Web Services (EWS) providing Django-style ORM interface for Exchange mailboxes.

Pending
Overview
Eval results
Files

contacts.mddocs/

Contacts and Distribution Lists

Contact management functionality for creating, updating, and organizing contact information. Includes support for distribution lists and contact groups.

Capabilities

Contact Management

class Contact:
    def __init__(self, account: Account = None, folder: Folder = None, **kwargs):
        """Create a new contact."""
    
    # Personal information
    display_name: str
    given_name: str
    middle_name: str
    surname: str
    nickname: str
    title: str
    generation: str
    
    # Contact details
    email_addresses: list[EmailAddress]
    phone_numbers: list[PhoneNumber]
    physical_addresses: list[PhysicalAddress]
    im_addresses: list[str]
    
    # Business information
    company_name: str
    department: str
    job_title: str
    manager: str
    assistant_name: str
    office_location: str
    
    # Personal details
    birthday: EWSDate
    wedding_anniversary: EWSDate
    spouse_name: str
    children: list[str]
    
    def save(self, update_fields: list = None):
        """Save the contact."""
    
    def delete(self, delete_type: str = 'MoveToDeletedItems'):
        """Delete the contact."""

Distribution Lists

class DistributionList:
    def __init__(self, account: Account = None, folder: Folder = None, **kwargs):
        """Create a distribution list."""
    
    display_name: str
    file_as: str
    members: list[Member]
    
    def expand(self) -> list[Mailbox]:
        """Expand distribution list to get all members."""
    
    def save(self, update_fields: list = None):
        """Save the distribution list."""
    
    def delete(self, delete_type: str = 'MoveToDeletedItems'):
        """Delete the distribution list."""

Contact Properties

class EmailAddress:
    def __init__(self, email: str, label: str = 'EmailAddress1'):
        """Contact email address."""
    
    email: str
    label: str
    name: str

class PhoneNumber:
    def __init__(self, phone_number: str, label: str = 'PrimaryPhone'):
        """Contact phone number."""
    
    phone_number: str
    label: str

class PhysicalAddress:
    def __init__(self, label: str = 'Home', **kwargs):
        """Contact physical address."""
    
    label: str
    street: str
    city: str
    state: str
    country_or_region: str
    postal_code: str

Usage example:

from exchangelib import Contact, EmailAddress, PhoneNumber, PhysicalAddress

contact = Contact(
    account=account,
    folder=account.contacts,
    display_name='John Smith',
    given_name='John',
    surname='Smith',
    company_name='Example Corp',
    job_title='Software Engineer',
    email_addresses=[
        EmailAddress(email='john.smith@company.com', label='EmailAddress1'),
        EmailAddress(email='john@personal.com', label='EmailAddress2')
    ],
    phone_numbers=[
        PhoneNumber(phone_number='+1-555-123-4567', label='BusinessPhone'),
        PhoneNumber(phone_number='+1-555-987-6543', label='MobilePhone')
    ]
)

contact.save()

Install with Tessl CLI

npx tessl i tessl/pypi-exchangelib

docs

account-auth.md

advanced.md

attachments.md

calendar.md

contacts.md

datetime.md

folders.md

index.md

messages.md

search.md

tasks.md

tile.json