In a LotusScript Agent that is being run via WebQueryOpen, how do you get the name of the current server?
+1
A:
Set s = New NotesSession
Set db = s.CurrentDatabase
If db.Server <> "" Then
Set sName = New NotesName(db.Server)
Else
Set sName = New NotesName(s.Username)
End If
Derek
2008-09-12 18:21:20
A:
'initialize event of a WebQueryOpen agent
Dim s As New notessession
Dim servername As String
servername = s.UserName
`s.UserName` is not reliable: the code may be running as a web user, or under a special signing Notes ID< in which case you wouldn't be getting the actual server name from this call.
Ben Poole
2010-03-02 10:01:41
A:
The sample code already provided is good but I also do it this way and just get the hierarchical name of the server:
Set s = New NotesSession
Set db = s.CurrentDatabase
If db.Server <> "" Then
Set sName = New NotesName(db.Server)
Else
Set sName = New NotesName(s.Username)
End If
ServerName = sName.Abbreviated
A:
Gary's answer is the most appropriate. You can actually identify the server name using hierarchical syntax to.
dim session as new notesSession
dim strCurrServer as string
dim nmServer as notesName
strCurrServer = session.currentagent.servername
' this bit is optional
set nmServer = new notesName(strCurrServer)
' then you can do stuff like this
print nmServer.Abbreviated
That would be the fastest (dirtiest?) way to get the server name from the webquery open agent. The notesName class is a handy object for dealing with hierarchical names link text
giulio
2010-03-15 10:49:55