NABPerson

Example:

Dim n As New NABPerson()
Msgbox n.Shortname
Const NAB_FILENAME$ = "names.nsf"
Const DEBUG_USERNAME$ = "DEBUG_SCANNING_USER"

Public Class NABPerson
   'declarations
   Private pSession As NotesSession
   Private pDb As NotesDatabase
   Private pDoc As NotesDocument

   '/**
   ' * Constructor.
   ' */
   Public Sub New()
      Set Me.pSession = New NotesSession
      Dim view As NotesView
      Dim server As String
      Dim debug_user As String

      'get the users home server
      server = Me.pSession.GetEnvironmentString("MailServer", True)

      'get database
      Set Me.pDb = Me.pSession.GetDatabase(server, NAB_FILENAME)

      'get view
      Set view = Me.pDb.GetView("($Users)")

      'should we use a debug name
      debug_user = Me.pSession.GetEnvironmentString(DEBUG_USERNAME)
      If debug_user  "" Then
         'use debug name
         Set Me.pDoc = view.GetDocumentByKey(debug_user, True)
      Else
         'use active usename
         Set Me.pDoc = view.GetDocumentByKey(Me.pSession.Username, True)
      End If

      'verify that we found a document
      If Me.pDoc Is Nothing Then
         If debug_user  "" Then
            Error 9999, "User (" + debug_user + ") not found in Domino Directory on " + server
         Else
            Error 9999, "User (" + Me.pSession.Username + ") not found in Domino Directory on " + server
         End If
      End If
   End Sub

   '/**
   ' * Get the shortname of the user.
   ' */
   Public Property Get Shortname As String
      Shortname = Me.pDoc.Shortname(0)
   End Property

End Class