In HCL Notes and Domino environments, users often need to access attachments, example like PDF files without manually opening Notes. Opening such files directly in a web browser or via a batch script can streamline workflows, enhance integration with third-party systems, and reduce user dependency on the Notes client interface.
This blog demonstrates two practical approaches to open PDF attachments from Notes documents:
– Constructing a URL to open the PDF in a browser.
– Automating the process with a batch (.bat) file.
Approach 1: Constructing a URL to Open an Attached PDF
Domino provides a structured URL syntax that allows direct access to documents and their attachments through HTTP. By assembling the correct URL, you can open an attached PDF in any web browser.
Sample URL Format → http://////$File/?OpenElement
Explanation of URL Components
| Component | Description |
|---|---|
| * 192.168.139.1 | * Domino Server Hostname or IP Address |
| * Test.nsf | * Domino Database Filename |
| * ce043f5a16d9be7865258c150012dac5 | * View Universal ID (UNID) |
| * 67b8fe529f470db165258cb6002c83b6 | * Document UNID |
| * $FILE | * Reserved keyword to indicate file attachment |
| * 1.pdf?OpenElement | * Name of the attached file and the command to open it in the browser |
Note : Instead of IP Address provide the server host name.
Retrieve UNIDs Using LotusScript
=====================================**
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim unid As String
Set db = session.CurrentDatabase
Set view = db.GetView(“Sample”) ’ Replace “Sample” with your view name
unid = view.UniversalID
Msgbox "View UNID: " & unid
=====================================
Getting the Document UNID
=====================================**
Dim s As New NotesSession
Dim db As NotesDatabase
Dim vw As NotesView
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set vw = db.GetView(“Sample”) ’ Replace “Sample” with your view name
Set doc = vw.GetLastDocument
Msgbox doc.UniversalID
=====================================
Approach 2: Opening the PDF Using a Batch File
Once the URL is constructed, you can open the PDF automatically via a Windows batch script. This can be useful for launching attachments from custom applications or automating a business process.
Sample Batch File (.BAT) Script
=====================================
@echo off
start “” “http://ServerName/Test.nsf/ce043f5a16d9be7865258c150012dac5/67b8fe529f470db165258cb6002c83b6/$FILE/1.pdf?OpenElement”
=====================================
Running this script will launch the default web browser (based on the Operating System default web browser) and open the PDF file directly.
Conclusion : With the combination of Domino’s native URL structure and a bit of LotusScript, you can streamline the process of opening Notes document attachments:
– Easily access PDFs through web browsers.
– Automate access using simple .BAT files.
– Enhance integration with third-party systems or external workflow engines.
– This approach is particularly valuable in environments where minimizing reliance on the Notes client is a priority.
Disclaimer : This solution is provided as an illustrative example and has been tested in a controlled environment. We strongly recommend adapting and validating the code within your own development and QA environments before deploying it to production. Please note that this method is not officially supported by HCL Product Support. Any customization is undertaken at your own discretion.
Note : It has been considered and assumed that only one attachment is included in the Notes document.