Button Script To Add Server Connection Documents To Personal Address Book

This script can be used in an Action Button sent to users in order for them to
add server connection documents to their Personal Address Book. This script
will first alert the user to what is about to happen, then check for the
existence of one of two connection documents, add any connection documents as
appropriate, and notify the user how many connection documents were added.
 

Sub Click(Source As Button)
Messagebox "This action will automatically add Connection Documents to the
Huntsville servers if they do not already exist in your Personal Address
Book.", 0 + 64, "Huntsville Connection Documents"
Dim db As New NotesDatabase("" , "names.nsf")
Dim view As NotesView
Dim doc As NotesDocument
Dim success As Variant
Dim connect As NotesDocument
Dim State As Integer
State = 0
Set view = db.GetView("Connections")
Set doc = view.GetFirstDocument
While Not (doc Is Nothing)
If doc.Destination(0) =
"Server1Name(i.e.CN=RSCHUN-DH01/OU=RES/O=Raytheon/C=US)" Then
Goto NextServer
Else
Set doc = view.GetNextDocument(doc)
End If
Wend
Set connect = db.CreateDocument
connect.form = "local"
connect.type = "Connection"
connect.destination = "Server1Name(i.e.,
CN=RSCHUN-DH01/OU=RES/O=Raytheon/C=US)"
connect.lanportname = "TCPIP"
connect.connectiontype = "0"
connect.optionalnetworkaddress = "Server1IPAddress (i.e., xxx.xx.xx.xx)"
success = connect.ComputeWithForm( False, False)
Call connect.Save(True,True)
State = State + 1
NextServer:
Set view = db.GetView("Connections")
Set doc = view.GetFirstDocument
While Not (doc Is Nothing)
If doc.Destination(0) = "Server2Name" Then
Goto Alert
Else
Set doc = view.GetNextDocument(doc)
End If
Wend
Set connect = db.CreateDocument
connect.form = "local"
connect.type = "Connection"
connect.destination = "Server2Name"
connect.lanportname = "TCPIP"
connect.connectiontype = "0"
connect.optionalnetworkaddress = "Server2IPAddress(xxx.xx.xxx.xx)"
success = connect.ComputeWithForm( False, False)
Call connect.Save(True,True)
State = State + 1
Alert:
Select Case State
Case 0
Messagebox "Your Personal Address Book already has both Server Connection
Documents; no new connection documents were created." , 0 + 64 , "Finished!"
Case 1
Messagebox "Your Personal Address Book already had one of the Server
Connection documents; one new connection document was created." , 0 + 64,
"Finished!"
Case 2
Messagebox "Two new server connection documents were created in your Personal
Address Book." , 0 + 64, "Finished!"
End Select
End Sub
This was first published in November 2000

Dig deeper on Lotus Domino Directory

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

-ADS BY GOOGLE

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.UK

Close