Skip to main content

A powerful utility for cleaning and managing Exchange mailbox folders via EWS

Project description

Exchange Web Services Cleaner

A powerful utility for cleaning and managing Exchange mailbox folders via Exchange Web Services (EWS) with real-time monitoring of EWS operations.

EWS Cleaner

Features

  • Fast cleaning of Exchange mailbox folders
  • Real-time monitoring of EWS API calls
  • Performance statistics for EWS operations
  • User-friendly interface with colored output
  • Error handling with intelligent retry mechanisms
  • Impersonation support for administrator accounts
  • Cross-platform compatibility (Windows and Linux)

Requirements

  • Python 3.6 or higher
  • Exchange server with EWS access enabled
  • Network access to your Exchange server
  • Required Python packages (see requirements.txt)

Installation

  1. Clone or download the repository:
git clone https://github.com/yourusername/exchange-cleaner.git
  1. Install the required dependencies:
pip install -r requirements.txt

Usage

Basic Usage

Run the script without parameters to be prompted for credentials:

python exchange_cleaner_linux_fixed.py

The script will prompt you for:

  • Your email address
  • Your password
  • Whether to impersonate another user (optional)

Command Line Arguments

You can also provide credentials and options via command line:

python exchange_cleaner_linux_fixed.py [OPTIONS] [username] [password] [impersonated_user]

Available Options

Option Description
--server SERVER Specify the Exchange server URL (required)
--no-log-window Disable separate log window
--console-log Display logs in main console
--no-stats-window Disable statistics window
--classic-ui Use classic interface instead of Rich unified interface
--auto-monitor Automatically start EWS monitoring
-h, --help Display help information

Interface Commands

While running, the following commands are available:

  • 1-9: Select a folder by its number
  • m: Enable/disable EWS monitoring
  • s: Display EWS statistics
  • q: Exit the program
  • h or ?: Display help

Monitoring Interface

The monitoring interface displays:

  1. Current Processing Progress:

    • Folder name
    • Items processed
    • Items remaining
    • Processing speed
    • Estimated time remaining
  2. Progress History:

    • Historical data of folder processing
  3. EWS Statistics:

    • Active calls
    • Total calls
    • Min/Avg/Max times for API calls
  4. Recent Logs:

    • Last 5 log entries with severity indicators
  5. EWS Request Monitoring:

    • Recent API calls with timing information

Error Handling

The script implements intelligent error handling:

  • Server Busy: Automatically waits with appropriate back-off times
  • Database Unavailable: Waits for 30 seconds before retrying
  • Slow Calls: Adds delays for operations taking more than 1000ms
  • Network Issues: Graceful handling with appropriate retries

Advanced Features

Impersonation

For admin accounts, you can impersonate another user to manage their mailbox:

python exchange_cleaner_linux_fixed.py username password impersonated_user@domain.com

Custom Server

Specify a custom Exchange server:

python exchange_cleaner_linux_fixed.py --server outlook.office365.com username password

Troubleshooting

Common Issues

  1. Connection Failures:

    • Verify your network connectivity
    • Check that your Exchange server is accessible
    • Confirm EWS is enabled on your server
  2. Authentication Errors:

    • Verify your username and password
    • Check if your account requires MFA (not supported directly)
    • Try using an app password if MFA is enabled
  3. Performance Issues:

    • Large folders may take time to process
    • The script implements throttling to avoid server overload
    • Use the monitoring interface to track progress

Log Files

Log files are stored in:

  • Windows: %TEMP%\ews_logs.txt
  • Linux: /tmp/ews_logs.txt

View logs in real-time using:

tail -f /tmp/ews_logs.txt  # Linux

License

This software is released under the MIT License.

Credits

Developed by [Your Name/Organization]

Using libraries:

  • exchangelib
  • rich
  • colorama

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ews_folder_cleaner-1.0.0.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ews_folder_cleaner-1.0.0-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file ews_folder_cleaner-1.0.0.tar.gz.

File metadata

  • Download URL: ews_folder_cleaner-1.0.0.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.2

File hashes

Hashes for ews_folder_cleaner-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d795b02aa5ae92313e83927edb22b6e61403bfc2ae91ba2d54e3405f993327db
MD5 3526d3b4f58db6c6fea96bd7012a6957
BLAKE2b-256 5a774e7fdb5423297da17dbfc6d116dc8c40966a720e8e35d8aa9991a2d26ffa

See more details on using hashes here.

File details

Details for the file ews_folder_cleaner-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ews_folder_cleaner-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50bd1cf40daf9182fa493d05aaff5932c69e212e73f484aed4796959961f755a
MD5 dfe883c4017d34f5e92ae49e99000b8a
BLAKE2b-256 6551446552ac7bf0f883103658f1aaab231225d11107642e9ea16cafa7f188f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page