System.DirectoryServices - Novell NDS - Exception from HRESULT: 0
Jeg anvender følgende kode til at tilgå Novell NDS i VB.NET:Dim LDAPEntry As New DirectoryServices.DirectoryEntry("LDAP://192.168.1.12/o=server")
LDAPEntry.AuthenticationType = DirectoryServices.AuthenticationTypes.None
LDAPEntry.Username = "admin"
LDAPEntry.Password = ""
Dim LDAPSearcher As New System.DirectoryServices.DirectorySearcher(LDAPEntry)
LDAPSearcher.Filter = ("(&(objectClass=inetOrgPerson))")
LDAPSearcher.SearchScope = DirectoryServices.SearchScope.Subtree
LDAPSearcher.CacheResults = False
LDAPSearcher.PropertiesToLoad.Add("ADsPath")
LDAPSearcher.PropertiesToLoad.Add("objectClass")
LDAPSearcher.PropertiesToLoad.Add("uid")
LDAPSearcher.PropertiesToLoad.Add("givenName")
LDAPSearcher.PropertiesToLoad.Add("eMailAddress")
LDAPSearcher.PropertiesToLoad.Add("fullName")
LDAPSearcher.PropertiesToLoad.Add("title")
LDAPSearcher.PropertiesToLoad.Add("ObjectId")
Dim Results As System.DirectoryServices.SearchResultCollection = LDAPSearcher.FindAll()
For Each Result As System.DirectoryServices.SearchResult In Results
LDAPEntry = Result.GetDirectoryEntry()
System.Console.WriteLine("")
System.Console.WriteLine("Path: " & LDAPEntry.Path)
System.Console.WriteLine("Class: " & LDAPEntry.Properties("objectClass")(0))
System.Console.WriteLine("GUID: " & LDAPEntry.Properties("uid").Value)
System.Console.WriteLine("Given Name: " & LDAPEntry.Properties("givenName").Value)
System.Console.WriteLine("mail: " & LDAPEntry.Properties("mail").Value)
System.Console.WriteLine("title: " & LDAPEntry.Properties("title").Value)
System.Console.WriteLine("ObjectId: " & LDAPEntry.Guid.ToString())
System.Console.WriteLine("")
Next
Det virker sådan set også nogenlunde, bortset fra at jeg ikke kan få lov at anvende propertien Guid eller NativeGuid. Så får jeg følgende fejl:
Run-time exception thrown : System.Runtime.InteropServices.COMException - Exception from HRESULT: 0x8000500D.
Det er ret væsentligt at jeg kan få en eller anden form for Unique Identifier.
Håber at nogen kan hjælpe med dette problem.
På forhånd tak.
Mvh. Thomas