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.
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
- Clone or download the repository:
git clone https://github.com/yourusername/exchange-cleaner.git
- Install the required dependencies:
pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ ews-folder-cleaner==1.0.0
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 numberm: Enable/disable EWS monitorings: Display EWS statisticsq: Exit the programhor?: Display help
Monitoring Interface
The monitoring interface displays:
-
Current Processing Progress:
- Folder name
- Items processed
- Items remaining
- Processing speed
- Estimated time remaining
-
Progress History:
- Historical data of folder processing
-
EWS Statistics:
- Active calls
- Total calls
- Min/Avg/Max times for API calls
-
Recent Logs:
- Last 5 log entries with severity indicators
-
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
-
Connection Failures:
- Verify your network connectivity
- Check that your Exchange server is accessible
- Confirm EWS is enabled on your server
-
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
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ews_folder_cleaner-1.0.1.tar.gz.
File metadata
- Download URL: ews_folder_cleaner-1.0.1.tar.gz
- Upload date:
- Size: 19.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac02dbcf24fd6c2b40bbc2b49e663b2795477bebd423baf326b42a69b98edd5d
|
|
| MD5 |
dba25dd1affa121277c39e23bf813175
|
|
| BLAKE2b-256 |
458934bb196833cfa7795a3254517050a1d7662dd238da6cdd3771407358fa43
|
File details
Details for the file ews_folder_cleaner-1.0.1-py3-none-any.whl.
File metadata
- Download URL: ews_folder_cleaner-1.0.1-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fc3294676afbd3c940625555854cc094ab37c0cc57fc2067197ece5a0e7dbae
|
|
| MD5 |
45459063a9c44815487686c2ba691394
|
|
| BLAKE2b-256 |
13037049471350b49c3458ced398d678f0b286d81fbb979d29b9fcbc3fbebd2c
|