0

特定のユーザーを ADAM で検索する方法があります。

 'set up the LDAP entry object
        objEntry = New DirectoryEntry("LDAP://" & m_strLDAPServer & ":" & m_strLDAPPort & "/" & m_strLDAPEntry)
is the default but it must be set explicitly so that the props array can be passed in
        objSearcher = New DirectorySearcher(objChild, "(objectClass=*)", strProps)
        objSearcher.SearchScope = SearchScope.Base

 objSearcher = New DirectorySearcher(objChild, "(objectClass=*)", strProps)
        objSearcher.SearchScope = SearchScope.Base
        'carry out the search
        Try
            objResult = objSearcher.FindOne()
        Catch
            objResult = Nothing
        End Try

ADAM SQL: Like '%strUserName%'から結果を取得したいのですが、完全な文字列 "strUserName" のみを検索するメソッドFindOne()しか見つかりませんでしたが、SQL のような操作を実行していません。SQL LIKE のように検索するにはどうすればよいですか?

4

1 に答える 1

0

その作品はうまくいきます:

eobjEntry = New DirectoryEntry("LDAP://" & m_strLDAPServer & ":" & m_strLDAPPort & "/" & "cn=" & txtUserName & "," & m_strLDAPEntry)
    'set the user name and password, if necessary

    Dim search As New DirectorySearcher()

'here search & txtUserName & works SQL Like Operation objSearcher = New DirectorySearcher(objEntry, "(cn=" & txtUserName & ")") objSearcher.SearchScope = SearchScope.Base And SearchScope.OneLevel Dim result As SearchResult = search.FindOne()

于 2015-01-19T13:23:24.083 に答える