lotus-noteslotus-dominolotusscripthcl-notes

Can I use NotesDirectory.LookupNames on a secondary Domino directory defined through Directory Assistance?


In a LotusScript driven application we make heavy use of NotesDirectory.LookupNames to create DirNavs and retrieve data from person documents. Works fine just using the server's primary NAB: we're using ($Users) view for the lookup then return values from the matching person documents' fields.

Now we have to extend this so that we also are able to lookup people stored in a secondary NAB. This secondary NAB is replicated to the server where the application is running, and Directory Assistance is set up. AFAIK DA is basically working (e.g. the secondary NAB can be selected from in standard names dialogs), and the secondary NAB appears to be a full directory; at least database properties say that it's a "Domino Directory" type of DB.

Problem is: using NotesDirectory.LookupNames does not yield any results if we're looking for names stored in the secondary NAB, while looking for names stored in the primary one still works

Server this runs on is V 11.0.1; all NABs and da.nsf are running more or the latest design (ran design refreshes from templates located on a V 10.0.1 server)

Main question is: is this supposed to work in the first place? Documentation for the class just speaks of "the directories", so I assume that this should be possible. Any hint is very welcome

-- UPDATE 2021-02-24 --

for completeness here's the (corrected) test agent's code as suggested by Scott: user #1 is from the primary directory while #2 is from the secondary one

Sub Initialize
    Dim sn As New NotesSession
    Dim nDir As NotesDirectory
    Dim nDirNav As NotesDirectoryNavigator
    Dim sKey As String, sVw As String, sSrv As String
    Dim vItems As Variant, vItem As Variant, vResult As Variant, vKeys As Variant
    Dim i As Integer
    
    sVw = "($Users)"
    sSrv = "devtest/edcomTest"
    Set nDir = sn.Getdirectory(sSrv)
    nDir.Searchalldirectories = True 'Not really necessary, but doesn't hurt either
    ReDim vKeys(1)
    vKeys(0) = "sautor1"
    vKeys(1) = "Veronika.Test@edcomtest.de"
    ReDim vItems(2)
    vItems(0) = "Type"
    vItems(1) = "FullName"
    vItems(2) = "ShortName"
    ReDim vResult(0)
    
    Set nDirNav = nDir.Lookupnames(sVw, vKeys, vItems, False)
    Do While nDirNav.Namelocated
        Do While nDirNav.Matchlocated
            vItem = nDirNav.Getfirstitemvalue()
            vResult(0) = vItem(0)
            'Looping the other items
            For i=1 To 2
                vItem = nDirNav.Getnextitemvalue()
                vResult = ArrayAppend(vResult, vItem(0))
            Next
            Call nDirNav.Findnextmatch()
        Loop
        Call nDirNav.Findnextname()
    Loop
    
    Print Join(vResult, "; ")
    
End Sub

Solution

  • I'm highly embarrassed as the cause for this "failure" was a simple typo in a user's name, where I simply had mispelled "Veronika" as "Veronica"... (It's already corrected in the code snippet above)