G
Guest
Hello,
Here is my code that I got from internet and I am assuming this give me
e-mail address of the people in the active directory.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim rootEntry As New DirectoryEntry("GC://dc=oecc,dc=net")
Dim searcher As New DirectorySearcher(rootEntry)
searcher.PropertiesToLoad.Add("mail")
Dim results As SearchResultCollection
results = searcher.FindAll()
Dim result As SearchResult
For Each result In results
Response.Write(result.Properties("mail")(0))
Next
End Sub
I got “Object reference not set to an instance of an object†at line
Response.Write(result.Properties("mail")(0)), what am I missing?
Thanks,
Jim.
Here is my code that I got from internet and I am assuming this give me
e-mail address of the people in the active directory.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim rootEntry As New DirectoryEntry("GC://dc=oecc,dc=net")
Dim searcher As New DirectorySearcher(rootEntry)
searcher.PropertiesToLoad.Add("mail")
Dim results As SearchResultCollection
results = searcher.FindAll()
Dim result As SearchResult
For Each result In results
Response.Write(result.Properties("mail")(0))
Next
End Sub
I got “Object reference not set to an instance of an object†at line
Response.Write(result.Properties("mail")(0)), what am I missing?
Thanks,
Jim.