Manage Learn to apply best practices and optimize your operations.

Get Person Document from NAMES.NSF with CGI Remote User

At times it is necessary to get the details of the Domino "cgi - Remote_User" person Document in NAMES.NSF. In my case, I needed to get a value from the comments field (which was actually not a comment but a key value to get the person document in our custom Address Book).

I thought it was not a good idea to change the design of the Public Address Book(NAMES.NSF) because of the upgrades and such that this NSF goes through (e.g. the design changes could be lost).

So, I wrote something that would get the cgi varaible, Remote_User, and from that get the person document in NAMES.NSF. From there you can get the details in any of the fields in that person document. i.e. Phone Number, Email address, Comments.

Randy McDougall

Dim session as New NotesSession
Dim cgidoc as NotesDocument
Dim remote_user as String

Set cgidoc = session.DocumentContext

remote_user = cgidoc.Remote_User(0)

' This function is used to get the Person doc from names.nsf
' Randy McDougall Nov. 19, 1998


Dim db As New NotesDatabase ("", "names.nsf")

Dim view As NotesView

Dim IDdoc As NotesDocument

' Create a name string that will match a lookup in names.nsf people view

Dim positionOfChar As Long
Dim lengthOfString As Long

lengthOfString& = Len(remote_user)

theSpace = " "
positionOfChar& = Instr(1, remote_user, theSpace)

Dim holder As Long
holder = LengthOfString - positionOfChar

Dim FirstName As String
FirstName$ = Left$(remote_user, positionOfChar - 1)

Dim LastName As String
LastName$ = Right$(remote_user, holder )

nameString = LastName + " , " + FirstName


Set view = db.GetView("People")

Set IDdoc = view.GetDocumentByKey(nameString)

'Here you can get any value you like
'I needed an id(key value) from the comments field
Dim ID As String
ID = IDdoc.comment(0)

Dig Deeper on Domino Resources - Part 6



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...