Domino - Lotus Notes - Adding Connection Documents Globally

Posted on 2007-10-15
Last Modified: 2013-12-18

Does anyone know if it is possible to add connection documents on a global basis rather than on each inidividual Lotus Notes client?

Question by:NeoI5theOne
    LVL 22

    Expert Comment

    I don't think connection documents can be managed via policies (but they should be).

    We created our own tool using LotusScript that can do it, though.  Let me know if you need that solution.

    Author Comment

    I am happy with any solution that will save me some time :)

    If you don't mind sharing your LotusScript solution that would be very much appreciated.
    LVL 63

    Accepted Solution

    Not sure why connection docs would be used that often.

    For TCPIP based networks, if the DNS is working correctly, no connection doc is needed.

    Is this for Dial up access ?

    I hope this helps !

    LVL 63

    Expert Comment

    In addition Dial-up settings can be set via Policies in R7 at least.

    LVL 22

    Assisted Solution

    I pulled this example out of my NotesAddressBook class, so it won't work stand alone.  You should be able to get the idea, though.  mSess is just an initialized NotesSession object.  mDb is a class member used by subsequent methods.  Me.IsDatabaseSupported is a class method that returns true only for local address books in this case (I'll post that code also).  ThrowError is a class member that maintains an error stack.  Once you've converted all the class member stuff, this function should work stand alone.

          ' * Creates a new connection document or updates an existing connection document.
          ' * @param serverName The name of the server listed in the connection document.
          ' * @param serverAddress The address of the server listed in the connection document.
          ' * @param overwrite Set to True to overwrite an existing connection document with a new address.
          ' * @return A NotesDocument containing the location document.
          ' */
          Public Function CreateConnectionDocument(Byval serverName As String, Byval serverAddress As String, Byval overwrite As Boolean) As NotesDocument
                Dim dc As NotesDocumentCollection
                Dim docConnection As NotesDocument
                Dim bDirty As Boolean
                If (TRAP_ERRORS) Then On Error Goto CATCH
                bDirty = False
                Forall db In mSess.AddressBooks
                      Set mDb = db
                      If (mDb.Open("", "")) Then
                            If (Me.IsDatabaseSupported(mDb)) Then
                                  Set docConnection = Nothing
                                  Set dc = mDb.Search({Type="Connection" & @Lowercase(@Name([Canonicalize]; Destination))=@Lowercase(@Name([Canonicalize]; "} & serverName & {"))}, Nothing, 0)
                                  If (dc.Count > 0) Then Set docConnection = dc.GetFirstDocument()
                                  If (docConnection Is Nothing) Then
                                        Set docConnection = mDb.CreateDocument()
                                        docConnection.Form = "local"
                                        docConnection.Type = "Connection"
                                        docConnection.ConnectionType = "0" ' Local Area Network
                                        docConnection.LanPortName = "TCPIP"
                                        docConnection.PortName = "TCPIP"
                                        docConnection.ConnectionLocation = "*"
                                        docConnection.Source = "*"
                                        docConnection.ConnectionRecordFirst = "1" ' Normal
                                        docConnection.RepPriority = "0" ' Low & Medium & High
                                        docConnection.DestinationDomain = "*"
                                        bDirty = True
                                        If ((Lcase(docConnection.OptionalNetworkAddress(0)) = Lcase(serverAddress)) And _
                                        (Lcase(docConnection.Destination(0)) = Lcase(serverName))) Then
                                              Set CreateConnectionDocument = docConnection
                                              Exit Function
                                              If (overwrite) Then bDirty = True
                                        End If
                                  End If
                                  If (bDirty) Then
                                        docConnection.Destination = serverName
                                        docConnection.OptionalNetworkAddress = serverAddress
                                        docConnection.PhoneNumber = serverAddress
                                        Call docConnection.ComputeWithForm(True, False)
                                        Call docConnection.Save(True, False)
                                  End If
                                  Set CreateConnectionDocument = docConnection
                                  Exit Function
                            End If
                            Call mDb.Close()
                            Set mDb = Nothing
                      End If
                End Forall
                Exit Function
                Call Me.ThrowError("")
          End Function

    Here's the IsDatabaseSupported class member.  All it does is to check the class's properties against a database to see if it should be processed.  This lets me specify settings for the class at runtime so that it only process specific address books or certain types of address books.  You could modify this method by hard coding the class properties (in this code all class properties are prefixed with a lower case m).

           ' * Checks whather a database is supported by this class based on current settings.
           ' * @param db The NotesDatabase to check.
           ' * @return True if the database is supported; False otherwise.
           ' */
          Private Function IsDatabaseSupported(db As NotesDatabase) As Boolean
                IsDatabaseSupported = False
                If (mReplicaId <> "") Then If (Ucase(db.ReplicaID) <> Ucase(mReplicaId)) Then Exit Function
                If (mFilepath <> "") Then If (Lcase(db.FilePath) <> Lcase(mFilepath)) Then Exit Function
                If (mFilename <> "") Then If (Lcase(db.FileName) <> Lcase(mFilename)) Then Exit Function
                IsDatabaseSupported = True
                If (db.Server = "") Then
                      ' Can't trust IsXXXAddressBook for public address books on local machine.
                      If (mIncludePublicNabs And db.IsPrivateAddressBook) Then If (Not db.GetView("Servers") Is Nothing) Then Exit Function
                      If (mIncludePrivateNabs And db.IsPrivateAddressBook) Then If (db.GetView("Servers") Is Nothing) Then Exit Function
                End If
                If (mIncludePublicNabs And db.IsPublicAddressBook) Then Exit Function
                If (mIncludePrivateNabs And db.IsPrivateAddressBook) Then Exit Function
                IsDatabaseSupported = False            
          End Function

    Author Comment

    SysExpert, yes it is basically for a remote access solution which I need to send the replication through a specific port.  Otherwise DNS would suffice.

    Author Comment

    Actually I might be able to work something
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    This is an old article, please see an updated version of this article, located here:
    IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now