Hente oplysninger i Active directory
Hej EksperterJeg henter en bruger op fra AD'eren udfra brugernavnet:
Dim searchStr As String = "(&(sAMAccountName=" & str_user & ")(objectCategory=User))"
Dim config As NameValueCollection = ConfigurationSettings.GetConfig("appSettings")
Dim username As String = config("specialuser")
Dim password As String = config("specialpassword")
Dim entry As New DirectoryEntry(ldap_path_AD, username, password)
Dim searcher As New DirectorySearcher(entry, searchStr)
Dim userResult As SearchResult = searcher.FindOne()
str_name = userResult.GetDirectoryEntry.Properties.Item("cn").Value
str_postalcode = userResult.GetDirectoryEntry.Properties.Item("postalcode").Value
str_mail = userResult.GetDirectoryEntry.Properties.Item("mail").Value
...
Hvordan kan man få fat på brugerid på brugeren? - altså et unikt id (tal).
- KAHS