First time working with AD thru SSIS. I have the connection working fine.
I believe I have the filter set correctly; however the value I get into my output columns is "System.DirectoryServices.ResultPropertyValueCollection". I am not receiving the actual values. i have double checked the name and case of each property . what am i doing wrong??
Here is my code
Dim ds As DirectoryServices.DirectorySearcher
Dim domainConnectionString As String = "LDAP://10.x.x.xx:xxx/DC=yyyy,DC=ORG"
Dim result As DirectoryServices.SearchResult
ds = New DirectorySearcher(New DirectoryEntry(domainConnectionString, "login", "password"))
ds.Filter = "(EmployeeID=" & Trim(CStr(Row.EMPIDNBR)) & ")"
ds.SearchScope = SearchScope.Subtree
ds.SearchScope = SearchScope.Subtree
Try
result = ds.FindOne
Row.ADLoginID = Left(Trim(result.Properties("SamAccountName").ToString), 10)
Row.ADLoginID = Left(Trim(result.Properties("SamAccountName").ToString), 10)
Row.EMail = Left(Trim(result.Properties("mail").ToString), 50)
Row.Dept = Left(Trim(result.Properties("Department").ToString), 15)
Catch ex As Exception
Row.Dept = vbNullString
Row.EMail = vbNullString
Row.ADLoginID = vbNullString
Row.AdError= ex.Message
End Try
Thanks!