LotusScript: Button to create connections checking

Tags:
Lotus Notes
LotusScript
Hello, I need to make this work using this TechNote: http://www-01.ibm.com/support/docview.wss?uid=swg21208108 so that the button checks against not only names.nsf but general Address Books. Could you please help me?
Sub Click(Source As Button)

Messagebox "MESSAGE", 0 + 64, "BOX NAME"

Dim workspace As New NotesUIWorkspace
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
Set view = db.GetView("Connections")
Set doc = view.GetFirstDocument
While Not (doc Is Nothing) '

If doc.Destination(0) = "SERVER" And doc.optionalnetworkaddress(0) = "SERVER" Then

Goto OpenDatabase
Else

Set doc = view.GetNextDocument(doc)

End If

Wend

Set connect = db.CreateDocument

connect.form = "local"

connect.type = "Connection"

connect.destination = "SERVER"

connect.lanportname = "TCPIP"

connect.connectiontype = "0"

connect.optionalnetworkaddress = "IP"

success = connect.ComputeWithForm( False, False)

Call connect.Save(True,True)

'Open the desired database on SERVER
OpenDatabase:
Call workspace.OpenDatabase ( "SERVER", "PATH","" , "", True, False )

End Sub


Software/Hardware used:
Lotus Script

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question: 2  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • carlosdl
    If you are getting errors, or your code is not working like you expect, it would be a good idea to explain the exact problem you are having.
    84,195 pointsBadges:
    report
  • AnalystBeeWorker
    The script above has no error at all and it works perfectly.
    My request is how to possibly verify against <Address Books> instead of names.nsf.

    I´ve tried adding at the start in place of what is written already:
    Dim session As New NotesSession
    Dim view As NotesView
    Dim doc As NotesDocument
    Dim nextdoc as NotesDocument
    Dim destServer As Variant
    Dim allnabs as Variant
    allnabs=session.addressbooks
    Forall books In allnabs
    'If The NAB Is Private, Than It Should Be Your Personal NAB
    If books.isprivateaddressbook Then
    'Verify if The NAB is Open, If Not, Open it
    If Not(Books.isopen) Then
    Call Books.open("",books.filename)
    End If
    Set view = books.GetView("Connections")
    Set doc = view.GetFirstDocument
    While Not doc Is Nothing
        destServer = doc.GetItemValue("Destination")
    Set nextdoc=view.GetNextDocument(doc)
          'THE BELOW LINE MUST BE MODIFIED TO SPECIFY THE RELATIVE SERVER NAME:
    If destServer(0) = "CN=serverName/O=domain" Then

    To the code, but I get an error "Variant does not contain an object" and I don´t understand where the error happens.
    15 pointsBadges:
    report

Forgot Password

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

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: