Manage Learn to apply best practices and optimize your operations.

Connection Button In Lotusscript

Databases are moved to different servers or diectories for various reasons. In
order to communicate to the users the new location of the database, I create a
connection button in the old database's About document, set the old database to
Read only, and set the Database Properties to launch the About Document. The
connection button checks to see if a connection document has already been
created for the destination server, creates a connection document in their
Personal Name and Address Book and adds the newly located database to their

Here is my LotusScript version
Create --> Hotspot --> Button
Click on Script

Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
Dim destination As Variant

'Scan through Connection documents to check whether one has already been
created for destination server
Set db = session.GetDatabase("","names.nsf")
Set view = db.GetView("Connections")
Set doc = view.GetFirstDocument

While Not(doc Is Nothing)
destination = doc.GetItemValue("Destination")
If (destination(0) = "CN=NWS1/O=ABC" Or destination(0) =
"CN=NWS1/O=abc" _
Or destination(0) = "CN=nws1/O=ABC" Or destination(0) =
"CN=nws1/O=abc" _
Or destination(0) = "NWS1" Or destination(0) = "nws1") Then
Goto OpenDatabase
End If
Set doc = view.GetNextDocument(doc)

'Add a server connection document for NWS1
Set uidoc = workspace.ComposeDocument _
( "", "names.nsf", "Connection" )
Call uidoc.FieldSetText( "ConnectionType","Local Area Network")
Call uidoc.FieldSetText( "Destination","NWS1/ABC")
Call uidoc.Refresh
Call uidoc.FieldSetText( "LanPortName","TCPIP")
Call uidoc.FieldSetText( "OptionalNetworkAddress","")
Call uidoc.Save
Call uidoc.Close

'Open the desired database on NWS1
Call workspace.OpenDatabase ( "NWS1/ABC", "directory/database.nsf","" ,
"", True, False )

End Sub

Dig Deeper on Lotus Notes Domino Administration Tools

  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...