python code to load a lotus notes nsf file and recursively extract all docs and atttachments
📂 Lotus Notes NSF Data Extractor This Python script extracts documents and attachments from a Lotus Notes .nsf database and saves them into structured folders on your filesystem.
🚀 Features ✅ Connects to Lotus Notes NSF databases using COM automation. ✅ Extracts all documents and their fields into text files. ✅ Retrieves and saves embedded attachments. ✅ Organizes data into folders named after each document's UniversalID. 📁 Repository 🔗 GitHub: rossn-hc/lotus_leap
🛠️ Requirements 💻 Windows OS (for win32com.client) 📧 Lotus Notes Client installed (to access .nsf files) 🐍 Python 3.7+ 📦 Python Dependencies pywin32 — COM interface to interact with Lotus Notes. ⚙️ Setup Instructions 1️⃣ Clone the Repository bash Copy Edit git clone https://github.com/rossn-hc/lotus_leap.git cd lotus_leap 2️⃣ Create and Activate a Virtual Environment Windows CMD: bash Copy Edit python -m venv venv venv\Scripts\activate PowerShell: bash Copy Edit python -m venv venv .\venv\Scripts\Activate.ps1 3️⃣ Install Dependencies bash Copy Edit pip install pywin32 4️⃣ Place the .nsf File Ensure the .nsf file you want to query is located in the Lotus Notes Data folder, typically found at:
java
Copy
Edit
C:\Program Files (x86)\IBM\Lotus\Notes\Data
📖 Usage
bash Copy Edit python extract_nsf_data.py 📂 Output The extracted data will be saved in an output directory (default: ./output). Each document from the .nsf file will have its own folder, named using the document's UniversalID.
🗂️ Output Folder Structure: bash Copy Edit output/ ├── / │ ├── document.txt # Document fields and values │ └── attachment1.ext # Extracted attachment (if any) ├── / │ ├── document.txt │ └── attachment2.ext ... document.txt — Contains all fields and values from the document. Attachments — All embedded files extracted from the document. 💡 Custom Output Directory: To specify a different output directory, use the output_dir parameter in the function call.
🛑 Troubleshooting
Ensure Lotus Notes is installed and properly configured.
Run the script with the same user profile as Lotus Notes.
Verify the .nsf file exists in the Lotus Notes Data folder.
Use relative paths when specifying the .nsf file.
Run the script with elevated privileges if necessary. 📄 License MIT License
This README is now optimized for clarity and presentation. Let me know if you'd like further changes!