Domino Code Fragment

Code Name*
getQualifiedHostName(serverName)
Date*
10/01/2001
Source (or email address if you prefer)*
Jamie Magee
IP address:.
Description*
Given a serverName, finds the server doc and returns the HTTP_HostName field for use in the prefix to any URL related to that server.
Type*
LotusScript
Categories*
Email/PIM, Website Tools, Workflow
Implementation:
None (plug and play)
Required Client:
Server:
Limitations:
Comments:
Files/Graphics attachments (if applicable): Code:
Function getQualifiedHostName(sname As String) As String
Dim session As New NotesSession
Dim books As Variant
Dim view As NotesView
Dim doc As NotesDocument
Dim done As Variant

books = session.AddressBooks
done = False

Forall b In books
' check every Domino Directory, unless we're already done
If ( b.IsPublicAddressBook ) And ( Not done ) Then
Call b.Open( "", "" )
' look up server's last name in Servers view of address book
Set view = b.GetView( "($ServersLookup)" )
If view Is Nothing Then
Exit Forall
End If
Set doc = view.GetDocumentByKey( sname )
' if server is found, get the host name
If Not ( doc Is Nothing ) Then
getQualifiedHostName = doc.HTTP_HostName(0)
done = True
End If
End If
End Forall
' if done is still False, the server wasn't found
If Not done Then
getQualifiedHostName = sname + ".intranet.martinscott.com" ' <- ENTER YOUR DEFAULT HERE
End If
End Function