问题描述
您好,
这是我从互联网上获取的代码,我假设这给了我
活动目录中人员的电子邮件地址。
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load
' '将用户代码置于此处初始化页面
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()
昏暗的结果作为SearchResult
对于每个结果在结果中
Response.Write(结果.Properties(mail)(0))
下一页
结束子
我有一个??对象引用未设置为objecta的实例??在线
Response.Write(result.Properties(" mail")(0)),我缺少什么?
谢谢,
吉姆。
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 a??Object reference not set to an instance of an objecta?? at line
Response.Write(result.Properties("mail")(0)), what am I missing?
Thanks,
Jim.
推荐答案
这篇关于问:搜索活动目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!