How can I push out a connection document to all lotus notes clients.
Subject: Connection Docments
why? what are you trying to achieve?
Subject: Connection Docments
Here’s code that I used a couple of years ago. An e-mail with a button containing this code was sent to users in one region so they could use a new server. It could easily be adapted to other uses. You potentially could put it into a database or document post-open event which would do it all silently without the users’ consent. A second example is below.I think this was adapted from several sources including this forum and NotesNet Today.
from: http://www.notes.net/Today.nsf/0/d1a24aa4e36508cf852564b500628549
Sub Click(Source As Button)
Msgbox "this will set your mail server to serverX/dom"
Call UpdateUsersLocationDocument()
End Sub
Function UpdateUsersLocationDocument()
Dim viewLocations As NotesView
Dim docLocation As NotesDocument
Dim docPerson As NotesDocument
Dim dbNAB As NotesDatabase
Dim dbPAB As NotesDatabase
Dim LocationDocument As String
Dim nnUserName As NotesName
Dim PersonalAddressBook As String
Dim MailFile As String
Dim MailFilePerson As String
Dim ws As New NotesUIWorkspace
Dim session As New NotesSession
Set dbCurrent = session.currentDatabase
’ Get the personal address book from the notes.ini and remove any cascaded local address books
PersonalAddressBook = Trim( session.GetEnvironmentString( "Names", True ) )
If Instr( PersonalAddressBook, "," ) > 0 Then
PersonalAddressBook = Left$(PersonalAddressBook, Instr(PersonalAddressBook, ",") -1)
Else
If Instr(PersonalAddressBook, ";") > 0 Then
PersonalAddressBook = Left$(PersonalAddressBook, Instr(PersonalAddressBook, ";") -1)
End If
End If
’ Get the personal address book, exit if cannot be opened
Set dbPAB = session.GetDatabase("", PersonalAddressBook)
If dbPAB.IsOpen = False Then Goto FinishFunction
’ Get the current location document in use, exit if any errors
Set viewLocations = dbPAB.GetView( "Locations" )
If viewLocations Is Nothing Then Goto FinishFunction
LocationDocument = Trim(session.GetEnvironmentString("Location",True))
If LocationDocument = "" Then Goto FinishFunction
LocationDocument = Left$(LocationDocument, Instr(LocationDocument, ",") -1)
If LocationDocument = "" Then Goto FinishFunction
Print LocationDocument
Set docLocation = viewLocations.GetDocumentByKey(LocationDocument)
If docLocation Is Nothing Then Goto FinishFunction
’ Get the Public Address Book from the current server
Set dbNAB = session.GetDatabase( dbCurrent.Server, "names.nsf" )
If dbNAB.IsOpen = False Then Goto FinishFunction
’ Update the Location Document
docLocation.MailServer = "serverX/dom"
docLocation.Domain = "dom"
Call docLocation.Save(True, False)
Msgbox "done"
FinishFunction:
End Function
This is an adapted version which gets the name of the mailfile from the current location document. It has additional error handling. Certain errors may be handled differently, depending on the circumstances.
Function UpdateUsersLocationDocument()
Dim vLocations As NotesView
Dim docLocation As NotesDocument
Dim dbMailFile As NotesDatabase ' mailfile on server
Dim dbPAB As NotesDatabase ' personal addressbook
Dim curLocation As String
Dim MailFilePerson As String
Dim dbCurrent As NotesDatabase
Dim session As notesSession
Set session = New notesSession
Set dbCurrent = session.CurrentDatabase
’ Open the personal address book
Set dbPAB = session.GetDatabase( "", "names.nsf" )
If dbPAB.IsOpen = False Then
Msgbox "failure opening personal addressbook, names.nsf"
Beep
End
End If
’ Get the current location document in use, exit if any errors
curLocation$ = Trim( session.GetEnvironmentString( "Location", True ) ) ' get loc from notes.ini
curLocation$ = Left$(curLocation$, Instr(curLocation$, ",") -1) ' remove extra stuff
If curLocation$ = "" Then
Msgbox "failure -- no current location."
Beep
End
Else
Print "current location " & curLocation$
End If
Set vLocations = dbPAB.GetView("Locations")
If vLocations Is Nothing Then
Msgbox "failure opening Locations view"
Beep
End
End If
Set docLocation = vLocations.GetDocumentByKey(curLocation$)
If docLocation Is Nothing Then
Msgbox "failure -- no current location document"
Beep
End
End If
’ must be able to reach their mailserver if cur location specifies that mail is on server
If docLocation.MailType(0) = "0" Then ' zero means "on server"
Print "location doc indicates mailfile on SERVER"
Set dbMailFile = session.GetDatabase( docLocation.MailServer(0), docLocation.MailFile(0) )
If Not dbMailFile.IsOpen Then
Msgbox "failure -- cannot open your mail file (" & docLocation.MailFile(0) _
& ") on the server (" & docLocation.MailServer(0) & ")"
End
Else
Print "mailfile opened successfully " & docLocation.MailServer(0) & " " & docLocation.MailFile(0)
End If
Else
Print "location doc indicates use of LOCAL mailfile"
End If
End Function
Subject: RE: Connection Docments
Are you wanting to change the user’s home mail server?
Subject: RE: Connection Docments
I have a clusted servers that have multiple interfaces and it is pushing the wrong IP to the clients When I put in a connection doc to the server it corrects the problem. Is there a better way to deal with this?