470,849 Members | 1,074 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

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 2075

"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 discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.