473,402 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

system.directoryservices usage

I figured I'd start this post on the .NET general forum instead of the
ADSI forum but feel free to nudge me along if I am looking in the wrong
place.

I am working with System.DirectoryServices to connect up to Active
Directory and make a couple of queries. The trouble starts as soon as I
attempt to compile this thing. I receive "Type
'System.DirectoryServices.SearchResultCollection' has no constructors." from
the following code. Since I'm in learning mode I am certain I'm doing
something wrong here. Any ideas where to go with this would be welcome.

Imports System.DirectoryServices

Partial Class companycontact

Inherits System.Web.UI.Page

Const ADConnectionString As String =
"LDAP://tirpitz.home.warnocksolutions.com"

Private Sub test_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles test.Click

Dim oConnection As New DirectoryEntry(ADConnectionString)

Dim oSearcher As New DirectorySearcher(oConnection)

Dim oSearchResults As New SearchResultCollection()

Dim oSearchResult As New SearchResult

oSearcher.Filter = "(objectClass=user)"

oSearchResults = oSearcher.FindAll()

For Each oSearchResult In oSearchResults

output.Text = oSearchResult.Properties("name").ToString

Next

End Sub

End Class
Sep 22 '05 #1
3 2882
Sean,

Change the following line
Dim oSearchResults As New SearchResultCollection()
to
Dim oSearchResults As SearchResultCollection()

HTH, Jakob.
--
http://www.dotninjas.dk
http://www.powerbytes.dk
"Sean" wrote:
I figured I'd start this post on the .NET general forum instead of the
ADSI forum but feel free to nudge me along if I am looking in the wrong
place.

I am working with System.DirectoryServices to connect up to Active
Directory and make a couple of queries. The trouble starts as soon as I
attempt to compile this thing. I receive "Type
'System.DirectoryServices.SearchResultCollection' has no constructors." from
the following code. Since I'm in learning mode I am certain I'm doing
something wrong here. Any ideas where to go with this would be welcome.

Imports System.DirectoryServices

Partial Class companycontact

Inherits System.Web.UI.Page

Const ADConnectionString As String =
"LDAP://tirpitz.home.warnocksolutions.com"

Private Sub test_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles test.Click

Dim oConnection As New DirectoryEntry(ADConnectionString)

Dim oSearcher As New DirectorySearcher(oConnection)

Dim oSearchResults As New SearchResultCollection()

Dim oSearchResult As New SearchResult

oSearcher.Filter = "(objectClass=user)"

oSearchResults = oSearcher.FindAll()

For Each oSearchResult In oSearchResults

output.Text = oSearchResult.Properties("name").ToString

Next

End Sub

End Class

Sep 22 '05 #2
Just remove New from the oSearchResults declaration line.

"Sean" <no spam> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I figured I'd start this post on the .NET general forum instead of the
ADSI forum but feel free to nudge me along if I am looking in the wrong
place.

I am working with System.DirectoryServices to connect up to Active
Directory and make a couple of queries. The trouble starts as soon as I
attempt to compile this thing. I receive "Type
'System.DirectoryServices.SearchResultCollection' has no constructors." from
the following code. Since I'm in learning mode I am certain I'm doing
something wrong here. Any ideas where to go with this would be welcome.

Imports System.DirectoryServices

Partial Class companycontact

Inherits System.Web.UI.Page

Const ADConnectionString As String =
"LDAP://tirpitz.home.warnocksolutions.com"

Private Sub test_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Handles test.Click

Dim oConnection As New DirectoryEntry(ADConnectionString)

Dim oSearcher As New DirectorySearcher(oConnection)

Dim oSearchResults As New SearchResultCollection()

Dim oSearchResult As New SearchResult

oSearcher.Filter = "(objectClass=user)"

oSearchResults = oSearcher.FindAll()

For Each oSearchResult In oSearchResults

output.Text = oSearchResult.Properties("name").ToString

Next

End Sub

End Class

Sep 22 '05 #3
Thanks guys. Remind me to reread my code in the morning after playing
with this kind of thing at midnight.

"Jakob Christensen" <jc*@REMOVEpension.dk> wrote in message
news:C7**********************************@microsof t.com...
Sean,

Change the following line
Dim oSearchResults As New SearchResultCollection()
to
Dim oSearchResults As SearchResultCollection()

HTH, Jakob.
--
http://www.dotninjas.dk
http://www.powerbytes.dk
"Sean" wrote:
I figured I'd start this post on the .NET general forum instead of
the
ADSI forum but feel free to nudge me along if I am looking in the wrong
place.

I am working with System.DirectoryServices to connect up to Active
Directory and make a couple of queries. The trouble starts as soon as I
attempt to compile this thing. I receive "Type
'System.DirectoryServices.SearchResultCollection' has no constructors."
from
the following code. Since I'm in learning mode I am certain I'm doing
something wrong here. Any ideas where to go with this would be welcome.

Imports System.DirectoryServices

Partial Class companycontact

Inherits System.Web.UI.Page

Const ADConnectionString As String =
"LDAP://tirpitz.home.warnocksolutions.com"

Private Sub test_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
Handles test.Click

Dim oConnection As New DirectoryEntry(ADConnectionString)

Dim oSearcher As New DirectorySearcher(oConnection)

Dim oSearchResults As New SearchResultCollection()

Dim oSearchResult As New SearchResult

oSearcher.Filter = "(objectClass=user)"

oSearchResults = oSearcher.FindAll()

For Each oSearchResult In oSearchResults

output.Text = oSearchResult.Properties("name").ToString

Next

End Sub

End Class

Sep 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: hykim | last post by:
Hello, everyone. according to MSDN, there is any constructor of System.DirectoryServices.SearchResultCollection Class. if I implement DirectorySearcher.FindAll() method by myself, then how can I...
1
by: Jason Gleason | last post by:
I am using the following method in a web service that utilizes the system.directoryservices namespace: public ArrayList GetAllAppPools(){ System.DirectoryServices.DirectoryEntry apppools = new...
0
by: Chris Frohlich | last post by:
All, I've built an Employee Directory with ASP.NET app that queries Active Directory for users and builds links with the results. What I'm seeing is really intermittent failures to bind to the...
2
by: Kelvin | last post by:
Hello I am using web matrix develop a login page through Active Directory but I cannot figure out why it is giving me an error when importing system.directoryServices. Any help will do! thank ...
3
by: Sean | last post by:
I figured I'd start this post on the .NET general forum instead of the ADSI forum but feel free to nudge me along if I am looking in the wrong place. I am working with System.DirectoryServices...
6
by: Mark Rae | last post by:
Hi, I'm in the process of updating an ASP.NET v1.1 web app to v2. The app uses ActiveDirectory a great deal, and I'm trying to use the new System.Collections.Generic namespace where possible,...
1
by: sasikumarks | last post by:
Hi, Im using the following code to retrieve the user details from the AD server. But when i execute the code,it throws me the error. Please help me in this...
1
by: aamirghanchi | last post by:
Hi, I recently converted an ASP .net 1.1 project to 2.0 in VS 2005. Even though System.DirectoryServices reference has been added to the project, still for some reasons the Imports...
7
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.