EDN Admin
Well-known member
I have the code below which returns: "System.DirectoryServices.PropertyValueCollection" retrive teachers
currentADObject = New DirectoryEntry("LDAP://10.253.97.10/OU=050_Camp Dick Robinson EL,OU=Staff,DC=garrard,DC=ketsds,DC=net", username, password, AuthenticationTypes.Secure)
OUsearcher.SearchRoot = currentADObject
OUsearcher.SearchScope = SearchScope.OneLevel
OUsearcher.Filter = "(objectClass=user)"
results = OUsearcher.FindAll
For Each tuser As SearchResult In results
CDRTEACHERS(i).unique_sis_user_id = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRTEACHERS(i).username = tuser.GetDirectoryEntry.Properties("sAMAccountName").ToString
CDRTEACHERS(i).unique_sis_school_id = "050"
CDRTEACHERS(i).user_type = "2"
CDRTEACHERS(i).mbc_authentication = "0"
CDRTEACHERS(i).email = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRTEACHERS(i).firstname = tuser.GetDirectoryEntry.Properties("givenName").ToString
CDRTEACHERS(i).lastname = tuser.GetDirectoryEntry.Properties("sn").ToString
CDRTEACHERS(i).grade = "n/a"
CDRTEACHERS(i).password = "n/a"
i = i + 1
Next
retrieve students
currentADObject = New DirectoryEntry("LDAP://10.253.97.10/OU=050_Camp Dick Robinson EL,OU=Students,DC=garrard,DC=ketsds,DC=net", "asdf", "3ranger", AuthenticationTypes.Secure)
OUsearcher.SearchRoot = currentADObject
OUsearcher.SearchScope = SearchScope.OneLevel
OUsearcher.Filter = "(objectClass=user)"
results = OUsearcher.FindAll
For Each tuser As SearchResult In results
CDRUSERS(i).unique_sis_user_id = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRUSERS(i).username = tuser.GetDirectoryEntry.Properties("sAMAccountName").ToString
CDRUSERS(i).unique_sis_school_id = "050"
CDRUSERS(i).user_type = "1"
CDRUSERS(i).mbc_authentication = "0"
CDRUSERS(i).email = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRUSERS(i).firstname = tuser.GetDirectoryEntry.Properties("givenName").ToString
CDRUSERS(i).lastname = tuser.GetDirectoryEntry.Properties("sn").ToString
CDRUSERS(i).grade = "n/a"
CDRUSERS(i).password = "n/a"
i = i + 1
Next
My goal is to get all of the users specific information under the specified OU in the code above (their is more code but it is repeated of the above with a different OU).
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr
View the full article
currentADObject = New DirectoryEntry("LDAP://10.253.97.10/OU=050_Camp Dick Robinson EL,OU=Staff,DC=garrard,DC=ketsds,DC=net", username, password, AuthenticationTypes.Secure)
OUsearcher.SearchRoot = currentADObject
OUsearcher.SearchScope = SearchScope.OneLevel
OUsearcher.Filter = "(objectClass=user)"
results = OUsearcher.FindAll
For Each tuser As SearchResult In results
CDRTEACHERS(i).unique_sis_user_id = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRTEACHERS(i).username = tuser.GetDirectoryEntry.Properties("sAMAccountName").ToString
CDRTEACHERS(i).unique_sis_school_id = "050"
CDRTEACHERS(i).user_type = "2"
CDRTEACHERS(i).mbc_authentication = "0"
CDRTEACHERS(i).email = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRTEACHERS(i).firstname = tuser.GetDirectoryEntry.Properties("givenName").ToString
CDRTEACHERS(i).lastname = tuser.GetDirectoryEntry.Properties("sn").ToString
CDRTEACHERS(i).grade = "n/a"
CDRTEACHERS(i).password = "n/a"
i = i + 1
Next
retrieve students
currentADObject = New DirectoryEntry("LDAP://10.253.97.10/OU=050_Camp Dick Robinson EL,OU=Students,DC=garrard,DC=ketsds,DC=net", "asdf", "3ranger", AuthenticationTypes.Secure)
OUsearcher.SearchRoot = currentADObject
OUsearcher.SearchScope = SearchScope.OneLevel
OUsearcher.Filter = "(objectClass=user)"
results = OUsearcher.FindAll
For Each tuser As SearchResult In results
CDRUSERS(i).unique_sis_user_id = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRUSERS(i).username = tuser.GetDirectoryEntry.Properties("sAMAccountName").ToString
CDRUSERS(i).unique_sis_school_id = "050"
CDRUSERS(i).user_type = "1"
CDRUSERS(i).mbc_authentication = "0"
CDRUSERS(i).email = tuser.GetDirectoryEntry.Properties("userPrincipalName").ToString
CDRUSERS(i).firstname = tuser.GetDirectoryEntry.Properties("givenName").ToString
CDRUSERS(i).lastname = tuser.GetDirectoryEntry.Properties("sn").ToString
CDRUSERS(i).grade = "n/a"
CDRUSERS(i).password = "n/a"
i = i + 1
Next
My goal is to get all of the users specific information under the specified OU in the code above (their is more code but it is repeated of the above with a different OU).
Once you eliminate the impossible, whatever remains, no matter how improbable, must be the truth. - "Sherlock holmes" "speak softly and carry a big stick" - theodore roosevelt. Fear leads to anger, anger leads to hate, hate leads to suffering - Yoda. Blog - http://www.computerprofessions.co.nr
View the full article