If you wish to process and view standard/normal Microsoft 365 emails, you must manually edit the code:
- Open
main.py. - Go to line 1383 (
display_messages_resultsmethod). - Replace line 1383 with the code block from lines 1384 to 1395 (which is commented out in the source).
- This swap will make
display_messages_resultsshow the full message body instead of Clive-specialized parsing.
A comprehensive Python GUI application for exploring Microsoft Graph APIs with advanced dynamic filter builders, MSAL authentication, and nested folder browsing capabilities.
- Boolean Filters: True/false dropdown selections for properties like
isRead,hasAttachments - DateTime Filters: Custom date/time input with ISO format support (
YYYY-MM-DDTHH:MM:SSZ) - Number Filters: Numeric input with validation and range constraints (
$top,$skip) - Text Filters: Free-text search for content, subjects, and custom queries
- Email Filters: Specific email address filtering for sender/recipient queries
- Select Filters: Dropdown options for predefined values (importance levels, etc.)
- Multi-select Filters: Checkbox selections for field choosing (
$selectparameters) - Compound Filters: Complex filters with multiple input fields (
$orderBywith direction) - Static Filters: Pre-configured filters requiring no user input (
$expand)
- Interactive Authentication: Full OAuth flow with Microsoft Graph
- Token Management: Automatic token acquisition and refresh
- Real-time Status: Visual authentication status indicators
- Live API Calls: Execute queries directly against Microsoft Graph
- Error Handling: Comprehensive authentication error management
- Nested Folder Support: Recursive folder loading up to 10 levels deep
- Hierarchical Display: Visual folder tree with indentation and icons
- Folder Statistics: Total and unread item counts for each folder
- Path Preservation: Full hierarchy paths (e.g.,
Inbox/Projects/2025/January) - Folder Selection: Target specific folders for message queries
- Interactive Browser: Pop-up folder browser with search and selection
- Real-time Preview: Live preview of filter construction as you type
- Filter Combination: Add/remove multiple filters with visual feedback
- Template System: Variable substitution in filter templates
- URL Generation: Complete Microsoft Graph URLs with proper parameter encoding
- Clipboard Integration: One-click copying of generated URLs
- Query Execution: Direct API calls with formatted results
- Professional Design: Microsoft-inspired dark theme throughout
- Responsive Layout: Equal-split panels for endpoints and filter builders
- Visual Feedback: Button state changes and status indicators
- Scrollable Content: Handle large datasets with smooth scrolling
- Color-coded Elements: Method badges, category tags, and status indicators
- Formatted Results: Structured display of API responses
- Message Details: Subject, sender, date, read status, attachments
- Folder Information: Display names, item counts, hierarchy
- Error Reporting: Detailed error messages with status codes
- Result Limitations: Smart truncation for large datasets
- Python 3.8 or higher
- pip (Python package installer)
- Internet connection for MSAL authentication
-
Clone or download the project:
git clone <repository-url> cd Microsoft-API-Email
-
Install dependencies:
pip install -r requirements.txt
-
Configure Azure App Registration (Optional for MSAL):
- Copy
config_sample.cfgtoconfig.cfg - Update with your Azure app credentials:
[azure] clientId = your-azure-app-client-id tenantId = your-azure-tenant-id
- Copy
-
Run the application:
python main.py
python main.py- Click "π Authenticate" to sign in with Microsoft Graph (optional)
- Authentication enables live API calls and folder browsing
- Search: Type keywords to find specific endpoints
- Filter by Category: Choose from Mail, Calendar, Users, etc.
- Filter by Version: Select v1.0 or beta APIs
- Method Filter: Filter by GET, POST, PUT, DELETE
- Click Endpoints: Select an endpoint to build custom filters
- Select Endpoint: Click any endpoint card to open the filter builder
- Choose Filters: Each endpoint shows available filter types
- Configure Values:
- Boolean: Select true/false from dropdown
- Text: Enter search terms or email addresses
- Number: Input numeric values with validation
- DateTime: Enter ISO format dates
- Multi-select: Check/uncheck multiple options
- Real-time Preview: See filter construction as you type
- Add Filters: Click "β Add Filter" to include in query
- Remove Filters: Click "β Remove" to exclude from query
- Browse Folders: Click "ποΈ Browse Folders" after authentication
- Navigate Hierarchy: See nested folders with visual indentation
- View Statistics: Total/unread counts for each folder
- Select Folder: Choose target folder for message queries
- Folder Filtering: Automatically applies folder context to queries
- Execute Query: Click "π Execute Query with Custom Filters"
- View Results: See formatted API responses in popup window
- Copy URLs: Click "π Copy" to copy individual filters
- Clear Filters: Click "ποΈ Clear Selected Filters" to reset
- Export Results: Copy complete URLs to clipboard
- List Messages: Get user messages with extensive filtering
- Read status, date ranges, attachments, importance
- Sender filtering, content search, field selection
- Custom sorting and result limiting
- List Mail Folders: Browse folder hierarchy
- Folder name filtering, field selection
- Child folder expansion, sorting options
| Filter Type | Description | Example Usage |
|---|---|---|
| Boolean | True/false selections | isRead eq true, hasAttachments eq false |
| DateTime | ISO date/time filtering | receivedDateTime ge 2025-01-15T00:00:00Z |
| Number | Numeric with validation | $top=50, $skip=25 |
| Text | Free-text search | $search="project update" |
| Email address filtering | from/emailAddress/address eq 'user@domain.com' |
|
| Select | Predefined options | importance eq 'high' |
| Multi-select | Multiple field selection | $select=subject,from,receivedDateTime |
| Compound | Multiple related inputs | $orderBy=receivedDateTime desc |
| Static | No input required | $expand=childFolders |
- Interactive OAuth login via browser
- Token acquisition and storage
- Automatic token refresh
- Secure API calls with Bearer tokens
Mail.Read: Read user mail messagesMail.ReadWrite: Read and modify user mail
Create config.cfg with your Azure app details:
[azure]
clientId = 12345678-1234-1234-1234-123456789012
tenantId = 87654321-4321-4321-4321-210987654321- tkinter: GUI framework (included with Python)
- pyperclip: Clipboard operations for URL copying
- msal: Microsoft Authentication Library
- requests: HTTP client for API calls
- beautifulsoup4: HTML parsing for enhanced functionality
- python-dateutil: Enhanced date/time handling
- configparser: Configuration file management
- Ubuntu/Debian:
sudo apt-get install python3-tk - CentOS/RHEL:
sudo yum install tkinter - macOS: Included with Python from python.org
- Windows: Included with Python
- Verify Azure app registration settings
- Check client ID and tenant ID in config.cfg
- Ensure proper redirect URI configuration
- Review permission scopes in Azure portal
- Check internet connectivity
- Verify authentication status
- Review Microsoft Graph service status
- Check rate limiting and throttling
.
βββ main.py # Main application and GUI entry point
βββ requirements.txt # Python dependencies
βββ config_sample.cfg # Sample Azure configuration
βββ README.md # This documentation
βββ MSAL_SETUP.md # MSAL registration setup
βββ python_app/ # Optional: place for modularized scripts if used
pip install black flake8 mypy
black main.py
flake8 main.py
mypy main.pyManual and functional testing recommended. (No automated suite included by default.)
- Selected filters remain active until manually cleared
- Button states reflect current filter selection
- Real-time preview updates with each change
- Comprehensive validation for all input types
- Network error recovery and reporting
- Authentication state management
- Lazy loading of nested folders
- Efficient UI updates and rendering
- Smart caching of API responses
This project is open source and available under the MIT License.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
For issues and questions:
- Check the troubleshooting section
- Review Microsoft Graph documentation
- Open an issue on the project repository