Performs queries against Active Directory Domain Services.
Assembly: System.DirectoryServices (in System.DirectoryServices.dll)
Use a object to search and perform queries against an Active Directory Domain Services hierarchy using Lightweight Directory Access Protocol (LDAP). LDAP is the only system-supplied Active Directory Service Interfaces (ADSI) provider that supports directory searching. An administrator can make, alter, and delete objects that are found in the hierarchy. For more information, see Using System.DirectoryServices.
When you create an instance of , you specify the root you want to retrieve, and an optional list of properties to retrieve. The SearchRoot property enables you to set additional properties to do the following tasks:
Cache the search results on the local computer. Set the CacheResults property to true to store directory information on the local computer. Updates are made to this local cache and committed to Active Directory Domain Services only when the DirectoryEntry::CommitChanges method is called.
Specify the length of time to search, using the ServerTimeLimit property.
Retrieve attribute names only. Set the PropertyNamesOnly property to true to retrieve only the names of attributes to which values have been assigned.
Perform a paged search. Set the PageSize property to specify the maximum number of objects that are returned in a paged search. If you do not want to perform a paged search, set the PageSize property to its default of zero.
If the maximum number of returned entries and time limits exceed the limitations that are set on the server, the server settings override the component settings.
For a list of initial property values for an instance of the class, see the DirectorySearcher() constructor.
It is assumed that you have a general understanding of Active Directory Domain Services before using this class. For more information, see the System.DirectoryServices overview.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.