DirectorySearcher.SearchRoot Property
Assembly: System.DirectoryServices (in system.directoryservices.dll)
/** @property */ public DirectoryEntry get_SearchRoot () /** @property */ public void set_SearchRoot (DirectoryEntry value)
public function get SearchRoot () : DirectoryEntry public function set SearchRoot (value : DirectoryEntry)
Property Value
The DirectoryEntry object in the Active Directory hierarchy where the search starts. The default is a null reference (Nothing in Visual Basic).If SearchRoot is a null reference (Nothing in Visual Basic), the search root is set to the root of the domain that your server is currently using.
There are several ways to search in the global catalog:
-
Enumerate the global catalog and pick the first child.
-
Specify the server name. Use the DsGetDcName function to find the global catalog. For more information on the DsGetDcName function, see the topic "DsGetDcName" in the MSDN Library at http://msdn.microsoft.com/library.
-
Get the RootDSE of the global catalog and ask for "rootNamingContext".
-
Use the global catalog, specifying a search path as if using LDAP. For example, "GC://OU=..., DC=..., DC=...".
-
The following C# code shows how to enumerate the global catalog and pick the first child.
Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.