This tool allows you to export and import Outlook folder structures, facilitating easy synchronization or migration of folder organizations between different Outlook accounts.
- Export Outlook folder structure to a JSON file
- Import Outlook folder structure from a JSON file
- Supports nested folder hierarchies
- Command-line interface for easy integration into workflows
- Windows operating system
- Python 3.7 or higher
- Poetry for dependency management
- Microsoft Outlook installed on the system
Note: This tool is designed to work exclusively on Windows environments due to its dependency on the Win32 COM interface for Outlook.
-
Clone this repository:
git clone https://github.com/K-dash/outlook-folder-sync-tool.git cd outlook-folder-sync-tool
-
Install dependencies using Poetry:
poetry install
-
To export a folder structure:
poetry run python src/outlook_folder_export.py <Outlook account name> <Folder name to export>
-
To import a folder structure:
poetry run python src/outlook_folder_import.py <Outlook account name> <JSON file name>
-
Create executable files using PyInstaller:
poetry run pyinstaller --onefile src/outlook_folder_export.py poetry run pyinstaller --onefile src/outlook_folder_import.py
Alternatively, you can create both executables at once using:
poetry run pyinstaller --onefile src/outlook_folder_export.py src/outlook_folder_import.py
-
The executable files will be created in the
dist
directory. -
To export a folder structure:
dist\outlook_folder_export.exe <Outlook account name> <Folder name to export>
-
To import a folder structure:
dist\outlook_folder_import.exe <Outlook account name> <JSON file name>
-
Exporting the folder structure of the
Inbox
folder for the account[email protected]
:poetry run python src/outlook_folder_export.py [email protected] Inbox
-
Importing a folder structure from
folder_structure.json
to the account[email protected]
:poetry run python src/outlook_folder_import.py [email protected] folder_structure.json
-
Example of a JSON file structure (
folder_structure.json
):{ "name": "Inbox", "subfolders": [ { "name": "Project A", "subfolders": [ { "name": "Meetings", "subfolders": [] }, { "name": "Documents", "subfolders": [] } ] }, { "name": "Personal", "subfolders": [] }, { "name": "Archive", "subfolders": [ { "name": "2022", "subfolders": [] }, { "name": "2023", "subfolders": [] } ] } ] }
This JSON structure represents an
Inbox
with subfolders forProject A
(which has its own subfolders),Personal
, and anArchive
folder with yearly subfolders.
- Ensure that Outlook is installed and properly configured on your system.
- If you encounter permission issues, try running the script or executable as an administrator.
- Make sure the specified Outlook account exists and is accessible.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Add CI pipline