I am new to this. We have a "old" list of LDAP fields and I want to list what fields we currently have. I have this code and when it gets to a field we don't have it errors.
Can someone help me modify this to create a loop and list all of the fields in our LDAP?
Then I can modify the >>> oSearchResult.Properties("XXXX")(0).ToString()
to match ours
TIA
DougP
Can someone help me modify this to create a loop and list all of the fields in our LDAP?
Then I can modify the >>> oSearchResult.Properties("XXXX")(0).ToString()
to match ours
TIA
Code:
Public Function getEmployeeInfo(ByVal strEid As String) As Employee
Dim newEmployee As Employee = New Employee
Dim oDirectoryEntry As DirectoryEntry = New DirectoryEntry(strServerName, strUserName, strPasswordIn, AuthenticationTypes.None)
Dim oDirectorySearcher As DirectorySearcher = New DirectorySearcher(oDirectoryEntry)
oDirectoryEntry.Dispose()
oDirectorySearcher.Filter = String.Format("(vzeid={0})", strEid)
Dim oSearchResult As SearchResult = oDirectorySearcher.FindOne()
If Not (oSearchResult Is Nothing) Then
newEmployee.strEid = strEid
newEmployee.strVzid = oSearchResult.Properties("vzid")(0).ToString()
newEmployee.strName = oSearchResult.Properties("cn")(0).ToString()
newEmployee.strEmail = oSearchResult.Properties("mail")(0).ToString()
' lots more fields here ...
End If
oDirectorySearcher.Dispose()
Return newEmployee
End Function
DougP