Showing posts with label LotusScript. Show all posts
Showing posts with label LotusScript. Show all posts

Monday, July 22, 2013

Saving profile documents difference between Java and LotusScript/Formula

I ran across an issue that has been driving me nuts! I'm not sure if this is an error or by design. When I am working with profiledocuments in LotusScript and Formula languages, I can pull the profile document without giving a unique key parameter because it isn't required.

However, in Java, I can pull that same profile document, using "" as a unique key because it's required, read the correct values, and save it. However, when I save the profile document in Java, it doesn't update the profile document that the LotusScript and Formula languages. It seems to save a profile document separate from the LotusScript and Formula.

After I save the Java version of the profile document, I can only retrieve the Java version. When I open the profile document using LotusScript / Formula, it only retrieves the LotusScript / Formula version. Even after using getprofiledocumentcollection shows only one document, the one that will show depends on the language you are using.

However, when I start using a unique key, this problem goes away. ug. Anyone else had this issue or found a fix?

Monday, September 13, 2010

Lotus Script to check if a server is available

After searching through the Lotus Notes forums and blogs looking for code to determine if a server was up or not I figured out a good solution. Some of the examples I found use a template or database to check if the server is up. However there might be that chance that the template file is corrupt or missing. So here is a code snippet using the NotesDBDirectory class:


Function checkServerAvailability( ) As Boolean
' this function will check if a server is available from a user's client
On Error GoTo errorfound

Dim session As New NotesSession
Dim db As NotesDatabase
Dim dirdb As NotesDbDirectory
Dim ServerName As String

ServerName = InputBox("Enter the server name to check")

' assign database directory to dirdb variable
Set dirdb = session.GetDbDirectory(ServerName)

' grab the first database from the directory
' this line will throw the error if the server cannot be accessed
Set db = dirdb.GetFirstDatabase( DATABASE )


msgbox "Server " & Servername & " found"


checkServerAvailability = True

Exit Function

errorfound:
' since server is not found, return false with debug string
msgbox "Error" & Str(Err) & ": " & Error$

Exit Function


End Function