Examples: IsOnServer property (NotesSession - LotusScript®)
This function takes a person's last name, looks the name up in the People view of an Address Book, and returns the person's office phone number as a string. If the script is running on a server, the function uses the Domino® Directory on that server; otherwise, it uses the Domino® Directory on server Recife.
Function getOfficePhone( lname As String ) As String
Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim doc As NotesDocument
If session.IsOnServer Then
' use the Address Book on the same server as the script
Set db = New NotesDatabase( "", "names.nsf" )
Else
' use the Address Book on server Recife
Set db = New NotesDatabase( "Recife", "names.nsf" )
End If
Set view = db.GetView( "People" )
Set doc = view.GetDocumentByKey( lname )
getOfficePhone = doc.OfficePhoneNumber( 0 )
End Function