473,396 Members | 1,738 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,396 software developers and data experts.

ActiveDirectorySite

I am trying to get an instance of an ActiveDirectorySite object by using the
FindByName function. Here is the code snippet...

dim server as string = "myServer"
Dim ctx As New
ActiveDirectory.DirectoryContext(ActiveDirectory.D irectoryContextType.DirectoryServer, server)
Dim mySite As ActiveDirectory.ActiveDirectorySite

mySite = activedirectory.ActiveDirectorySite.FindByName(ctx ,"CN=opsbham")
The error is::
Run-time exception thrown :
System.DirectoryServices.ActiveDirectory.ActiveDir ectoryObjectNotFoundException - The Specified directory object cannot be found.

Am I using the wrong syntax to specify the site name?

I am trying to get instances of AD objects with out having to start at the
forest or domain level and loop through the entire environment. I have tried
to pass in the complete CN name structure and get the same result.

Any help is appreciated!
--
Jaret Langston
Amsouth Bank
Apr 24 '06 #1
1 2159

"Jaret Langston" <ja************@gmail.com> wrote in message
news:60**********************************@microsof t.com...
I am trying to get an instance of an ActiveDirectorySite object by using
the
FindByName function. Here is the code snippet...

dim server as string = "myServer"
Dim ctx As New
ActiveDirectory.DirectoryContext(ActiveDirectory.D irectoryContextType.DirectoryServer,
server)
Dim mySite As ActiveDirectory.ActiveDirectorySite

mySite = activedirectory.ActiveDirectorySite.FindByName(ctx ,"CN=opsbham")
The error is::
Run-time exception thrown :
System.DirectoryServices.ActiveDirectory.ActiveDir ectoryObjectNotFoundException
- The Specified directory object cannot be found.

Am I using the wrong syntax to specify the site name?

I am trying to get instances of AD objects with out having to start at the
forest or domain level and loop through the entire environment. I have
tried
to pass in the complete CN name structure and get the same result.

Any help is appreciated!
--
Jaret Langston
Amsouth Bank

Apr 28 '06 #2

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

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.