ActiveDirectorySite

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.DirectoryContextType.DirectoryServer, server)
Dim mySite As ActiveDirectory.ActiveDirectorySite

mySite = activedirectory.ActiveDirectorySite.FindByName(ctx,"CN=opsbham")


The error is::
Run-time exception thrown :
System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException - 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 said:
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.DirectoryContextType.DirectoryServer,
server)
Dim mySite As ActiveDirectory.ActiveDirectorySite

mySite = activedirectory.ActiveDirectorySite.FindByName(ctx,"CN=opsbham")


The error is::
Run-time exception thrown :
System.DirectoryServices.ActiveDirectory.ActiveDirectoryObjectNotFoundException
- 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!
 
Back
Top