Skip to content

Interacting with EWS

The following two projects have been tested are known to work well with the myexchange.rocks EWS implementation.

Examples

Example minimal Python code to connect:

    creds = exchangelib.Credentials(username, password)

    if False:
        # Set version client side, as the automatic version discovery is an extra
        # request which we do not support.
        version = exchangelib.Version(build=exchangelib.version.EXCHANGE_2007_SP1)
    else:
        version = None

    if autodiscover:
        account = exchangelib.Account(
            primary_smtp_address=smtp_address, credentials=creds, autodiscover=True, access_type=exchangelib.DELEGATE
        )
    else:
        config = exchangelib.Configuration(service_endpoint=url, credentials=creds, version=version)
        account = exchangelib.Account(
            primary_smtp_address=smtp_address, config=config, autodiscover=False, access_type=exchangelib.DELEGATE
        )