0
この機能を使用してユーザー名(すべてのユーザーは同じドメインにあります)からユーザーの電子メールアドレスを検索できましたが、 Windowsの10にアップグレードされて、私はエラーを取得しています:LDAPサーバーがWindows 10で正常に動作しない
The server is not operational
私はこの質問を参照して答えを自分のコードに変更を加えた、今私は、デフォルトのネーミングコンテキストを拾うが、エラーが解消されません: System.DirectoryServices - The server is not operational
Public Function UserEmail(ByRef Username As String) As String
UserEmail = ""
Dim deRoot As New DirectoryServices.DirectoryEntry("LDAP://RootDSE")
If Not deRoot Is DBNull.Value Then
Dim defaultNamingContext As String = deRoot.Properties("defaultNamingContext").Value.ToString()
Dim path As String
path = "LDAP://" & defaultNamingContext
Dim entry As New DirectoryServices.DirectoryEntry(Path)
Dim search As New DirectoryServices.DirectorySearcher(entry)
search.Filter = "(&(objectClass=user)(anr=" + Username + "))"
search.PropertiesToLoad.Add("mail")
Dim result As DirectoryServices.SearchResult
result = search.FindOne
If IsDBNull(result) Then
UserEmail = ""
Else
UserEmail = result.Properties("mail")(0)
End If
End If
Return UserEmail
End Function
コードは、ユーザーがWindows 7と8を使用しているところで正常に動作します。
ご意見はありますか?
このコードは各ユーザーのマシンで実行されますか? –
はい、Windows 7と8では問題なく動作しますが、Windows 10ではエラーが発生します。そのユーザー名がデータベースに保存されている別のユーザーに電子メールを送信します。 – DovesandChicks
これらのWindows 10マシンは、Windows 7/8と同じドメインに参加していますか? –