Performs queries against Active Directory Domain Services.
public ref class DirectorySearcher : System::ComponentModel::Component
[System.DirectoryServices.DSDescription("DirectorySearcherDesc")] public class DirectorySearcher : System.ComponentModel.Component
type DirectorySearcher = class inherit Component
Public Class DirectorySearcher Inherits Component
Use a DirectorySearcher 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 DirectorySearcher, 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
trueto 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
trueto 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.
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.
|Asynchronous Asynchronous Asynchronous Asynchronous||
Gets or sets a value that indicates if the search is performed asynchronously.
|AttributeScopeQuery AttributeScopeQuery AttributeScopeQuery AttributeScopeQuery||
Gets or sets the LDAP display name of the distinguished name attribute to search in. Only one attribute can be used for this type of search.
|CacheResults CacheResults CacheResults CacheResults||
Gets or sets a value indicating whether the result is cached on the client computer.
|CanRaiseEvents CanRaiseEvents CanRaiseEvents CanRaiseEvents||
Gets a value indicating whether the component can raise an event.(Inherited from Component)
|ClientTimeout ClientTimeout ClientTimeout ClientTimeout||
Gets or sets the maximum amount of time that the client waits for the server to return results. If the server does not respond within this time, the search is aborted and no results are returned.
|Container Container Container Container||Component)|
|DerefAlias DerefAlias DerefAlias DerefAlias||
Gets or sets a value indicating how the aliases of objects that are found during a search should be resolved.
|DesignMode DesignMode DesignMode DesignMode||
Gets a value that indicates whether the Component is currently in design mode.(Inherited from Component)
|DirectorySynchronization DirectorySynchronization DirectorySynchronization DirectorySynchronization||
Gets or sets an object that represents the directory synchronization control to use with the search.
|Events Events Events Events||
Gets the list of event handlers that are attached to this Component.(Inherited from Component)
|ExtendedDN ExtendedDN ExtendedDN ExtendedDN||
Gets or sets a value that indicates the format of the distinguished names.
|Filter Filter Filter Filter||
Gets or sets a value indicating the Lightweight Directory Access Protocol (LDAP) format filter string.
|PageSize PageSize PageSize PageSize||
Gets or sets a value indicating the page size in a paged search.
|PropertiesToLoad PropertiesToLoad PropertiesToLoad PropertiesToLoad||
Gets a value indicating the list of properties to retrieve during the search.
|PropertyNamesOnly PropertyNamesOnly PropertyNamesOnly PropertyNamesOnly||
Gets or sets a value indicating whether the search retrieves only the names of attributes to which values have been assigned.
|ReferralChasing ReferralChasing ReferralChasing ReferralChasing||
Gets or sets a value indicating how referrals are chased.
|SearchRoot SearchRoot SearchRoot SearchRoot||
Gets or sets a value indicating the node in the Active Directory Domain Services hierarchy where the search starts.
|SearchScope SearchScope SearchScope SearchScope||
Gets or sets a value indicating the scope of the search that is observed by the server.
|SecurityMasks SecurityMasks SecurityMasks SecurityMasks||
Gets or sets a value indicating which security access information for the specified attributes should be returned by the search.
|ServerPageTimeLimit ServerPageTimeLimit ServerPageTimeLimit ServerPageTimeLimit||
Gets or sets a value indicating the maximum amount of time the server should search for an individual page of results. This is not the same as the time limit for the entire search.
|ServerTimeLimit ServerTimeLimit ServerTimeLimit ServerTimeLimit||
The ServerTimeLimit property gets or sets a value indicating the maximum amount of time the server spends searching. If the time limit is reached, only entries that are found up to that point are returned.
|Site Site Site Site||Component)|
|SizeLimit SizeLimit SizeLimit SizeLimit||
Gets or sets a value indicating the maximum number of objects that the server returns in a search.
|Sort Sort Sort Sort||
Gets or sets a value indicating the property on which the results are sorted.
|Tombstone Tombstone Tombstone Tombstone||
Gets or sets a value indicating whether the search should also return deleted objects that match the search filter.
|VirtualListView VirtualListView VirtualListView VirtualListView||
Gets or sets a value indicating the virtual list view options for the search.
|CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type) CreateObjRef(Type)||
Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object.(Inherited from MarshalByRefObject)
|Dispose() Dispose() Dispose() Dispose()||
Releases all resources used by the Component.(Inherited from Component)
|Dispose(Boolean) Dispose(Boolean) Dispose(Boolean) Dispose(Boolean)||
Releases the managed resources that are used by the DirectorySearcher object and, optionally, releases unmanaged resources.
|Equals(Object) Equals(Object) Equals(Object) Equals(Object)||
Determines whether the specified object is equal to the current object.(Inherited from Object)
|FindAll() FindAll() FindAll() FindAll()||
Executes the search and returns a collection of the entries that are found.
|FindOne() FindOne() FindOne() FindOne()||
Executes the search and returns only the first entry that is found.
|GetHashCode() GetHashCode() GetHashCode() GetHashCode()||
Serves as the default hash function.(Inherited from Object)
|GetLifetimeService() GetLifetimeService() GetLifetimeService() GetLifetimeService()||
Retrieves the current lifetime service object that controls the lifetime policy for this instance.(Inherited from MarshalByRefObject)
|GetService(Type) GetService(Type) GetService(Type) GetService(Type)||Component)|
|GetType() GetType() GetType() GetType()||
Gets the Type of the current instance.(Inherited from Object)
|InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService() InitializeLifetimeService()||
Obtains a lifetime service object to control the lifetime policy for this instance.(Inherited from MarshalByRefObject)
|MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()||
Creates a shallow copy of the current Object.(Inherited from Object)
|MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean) MemberwiseClone(Boolean)||
Creates a shallow copy of the current MarshalByRefObject object.(Inherited from MarshalByRefObject)
|ToString() ToString() ToString() ToString()||Component)|
|Disposed Disposed Disposed Disposed||
Occurs when the component is disposed by a call to the Dispose() method.(Inherited from Component)
- DirectoryEntry DirectoryEntry DirectoryEntry DirectoryEntry
- DirectorySearcher DirectorySearcher DirectorySearcher DirectorySearcher
- ReferralChasingOption ReferralChasingOption ReferralChasingOption ReferralChasingOption
- SearchResultCollection SearchResultCollection SearchResultCollection SearchResultCollection
- SearchResult SearchResult SearchResult SearchResult
- SearchScope SearchScope SearchScope SearchScope
- SortOption SortOption SortOption SortOption
- System.DirectoryServices System.DirectoryServices System.DirectoryServices System.DirectoryServices