I am running the Visual Basic 6 code...
Articles and Tips: qna
01 Jun 2003
Q.
I am running the Visual Basic 6 code below, using a filter on User of CN (Common Name), but it does not find any entries. However, searching with "surname" does and with no filter the maximum of 20 entries are found. Why can't I use CN, I thought common name was always available and it is shown in all examples.
With NWDirQuery FullName = NDS_Tree Fields = "Surname, Given Name, NGW: Post Office" Filter = "user(Surname = Owen)" Filter = "User(CN= SOwen )" SearchScope = qrySearchSubtree SearchMode = qrySearchSynchronous MaximumResults = 20 Set objNWResults = .Search End With
My setup includes the following:
Windows 2000 Server running Service Pack 3
Novell NDS client 4.83 SP1_BETA_0711
Novell eDirectory Services v8.6.2
NwDirQ.dll ver 1.0.0.1
A.
I think your problem lies in the fact that you need to include "CN" in your fields requirement. Here is some code that works:
NWDirQuery1.FullName = strNDSName NWDirQuery1.Filter = "User( CN = " + txtSearchFor.Text + "*)" NWDirQuery1.SortKeys = "CN" NWDirQuery1.Fields = "CN, Full Name, Given Name, Surname" NWDirQuery1.SearchScope = qrySearchSubtree NWDirQuery1.SearchMode = qrySearchAsynchronous NWDirQuery1.MaximumResults = 1000 Set results = NWDirQuery1.Search
* Originally published in Novell AppNotes
Disclaimer
The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.