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

folders.mddocs/

Folders and Organization

Folder management for organizing and accessing Exchange folders, including standard folders (Inbox, Sent, Calendar) and custom folders. Supports folder creation, deletion, and hierarchical organization.

Capabilities

Folder Operations

class Folder:
    def __init__(self, account: Account = None, **kwargs):
        """Base folder class."""
    
    # Properties
    name: str
    display_name: str
    folder_class: str
    total_count: int
    child_folder_count: int
    unread_count: int
    
    # Hierarchy
    parent_folder_id: FolderId
    child_folders: list[Folder]
    
    def create_folder(self, name: str, folder_class: str = None) -> Folder:
        """Create a child folder."""
    
    def delete_folder(self, delete_type: str = 'HardDelete'):
        """Delete this folder."""
    
    def get_folder(self, name: str) -> Folder:
        """Get a child folder by name."""
    
    def move_folder(self, to_folder: Folder):
        """Move this folder to another parent."""
    
    def copy_folder(self, to_folder: Folder):
        """Copy this folder to another parent."""

class FolderCollection:
    def filter(self, *args, **kwargs):
        """Filter folders by criteria."""
    
    def all(self):
        """Get all folders."""
    
    def count(self):
        """Count folders."""

Standard Folders

# Standard folder types accessible via Account
class Account:
    inbox: Folder
    outbox: Folder  
    sent: Folder
    drafts: Folder
    deleted_items: Folder
    calendar: Folder
    contacts: Folder
    tasks: Folder
    notes: Folder
    journal: Folder
    junk_email: Folder
    
    # Public folders
    public_folders_root: Folder
    
    # Archive folders
    archive_inbox: Folder
    archive_deleted_items: Folder

Folder Traversal

# Traversal depth constants
DEEP: str = 'Deep'
SHALLOW: str = 'Shallow'

def get_folders(self, depth: str = SHALLOW) -> list[Folder]:
    """Get child folders with specified depth."""

def walk(self) -> Generator[Folder]:
    """Walk through all folders recursively."""

Usage example:

from exchangelib import DEEP, SHALLOW

# Create custom folder
custom_folder = account.inbox.create_folder('Important Projects')

# Get all folders
all_folders = account.inbox.get_folders(depth=DEEP)

# Find specific folder
project_folder = account.root.get_folder('Projects')

# Organize messages
for message in account.inbox.filter(subject__contains='Project'):
    message.move(custom_folder)

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