问:搜索活动目录 [英] Q: searching active directory

查看:69
本文介绍了问:搜索活动目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

这是我从互联网上获取的代码,我假设这给了我

活动目录中人员的电子邮件地址。


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.

推荐答案

吉姆。


你有没看过:

http://msdn.microsoft.com/library/de...etadsearch.asp




Juan T. Llibre

ASP.NET MVP

===========

" JIM.H " <季** @ discussions.microsoft.com>在消息中写道

news:61 ********************************** @ microsof t.com ...
Hi, Jim.

Have you had a look at :

http://msdn.microsoft.com/library/de...etadsearch.asp

?
Juan T. Llibre
ASP.NET MVP
===========
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
你好,
这是我从网上得到的代码,我假设这给了我
活跃的人的电子邮件地址目录。

Private Sub Page_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load
''用户代码初始化页面
Dim rootEntry作为New DirectoryEntry(GC:// dc = oecc,dc = net)
Dim searcher As New DirectorySearcher(rootEntry)
searcher.PropertiesToLoad.Add(" mail" ;)

昏暗的结果作为SearchResultCollection
结果= searcher.FindAll()

昏暗的结果作为SearchResult

对于每个结果在结果中
Response.Write(result.Properties(" mail")(0))
下一页

End Sub

我得到了对象引用 ñ设置为对象的实例在线
Response.Write(result.Properties(" mail")(0)),我缺少什么?
谢谢,
Jim。
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.






我有人可以告诉我我错过了什么,我从那个

网站获得了代码,但没有为我工作。


" Juan T. Llibre"写道:
I whci somebody could tell me what I am missing, I got the code from that
site but not workign for me.

"Juan T. Llibre" wrote:
吉姆。

你有没看过:

http://msdn.microsoft.com/ library / de ... etadsearch.asp


Juan T. Llibre
ASP.NET MVP
==== =======
JIM.H. <季** @ discussions.microsoft.com>在消息中写道
新闻:61 ********************************** @ microsof t.com。 ..
Hi, Jim.

Have you had a look at :

http://msdn.microsoft.com/library/de...etadsearch.asp

?
Juan T. Llibre
ASP.NET MVP
===========
"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
你好,
这是我从网上得到的代码,我假设这给了我
活动目录中人员的电子邮件地址。私有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")

昏暗的结果作为SearchResultCollection
结果= searcher.FindAll()

昏暗的结果作为SearchResult

对于每个结果在结果中
Response.Write(result.Properties(" mail")(0))
下一页

结束子

我得到了对象参考不是se t到对象的实例在线
Response.Write(result.Properties(" mail")(0)),我缺少什么?
谢谢,
Jim。
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.




你的DirectoryEntry构造函数不应该以LDAP开头://?


" JIM.H。 " <季** @ discussions.microsoft.com>在消息中写道

news:61 ********************************** @ microsof t.com ...
Shouldn''t your DirectoryEntry Constructor start with LDAP:// ?

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
你好,
这是我从网上得到的代码,我假设这给了我
活跃的人的电子邮件地址目录。

Private Sub Page_Load(ByVal sender As System.Object,ByVal e As
System.EventArgs)处理MyBase.Load
''用户代码初始化页面
Dim rootEntry作为New DirectoryEntry(GC:// dc = oecc,dc = net)
Dim searcher As New DirectorySearcher(rootEntry)
searcher.PropertiesToLoad.Add(" mail" ;)

昏暗的结果作为SearchResultCollection
结果= searcher.FindAll()

昏暗的结果作为SearchResult

对于每个结果在结果中
Response.Write(result.Properties(" mail")(0))
下一页

End Sub

我得到了对象引用未设置为对象的实例在线
Response.Write(result.Properties(" mail")(0)),我错过了什么?
谢谢,
Jim。
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.



这篇关于问:搜索活动目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆