Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
System.DirectoryServices Namespace

The System.DirectoryServices namespace provides easy access to Active Directory Domain Services from managed code. The namespace contains two component classes, DirectoryEntry and DirectorySearcher, which use the Active Directory Services Interfaces (ADSI) technology. ADSI is the set of interfaces that Microsoft provides as a flexible tool for working with a variety of network providers. ADSI gives the administrator the ability to locate and manage resources on a network with relative ease, regardless of the size of the network.

The classes in this namespace can be used with any of the Active Directory Domain Services service providers. The current providers are: Internet Information Services (IIS), Lightweight Directory Access Protocol (LDAP), Novell NetWare Directory Service (NDS), and WinNT.

ADSI is a programmatic interface for Microsoft Active Directory Domain Services that enables your applications to interact with diverse directories on a network using a single interface. Using ADSI, you can create applications that perform common tasks, such as backing up databases, accessing printers, and administering user accounts.

It is assumed that you have a general understanding of Active Directory Domain Services before using these classes. For more information on Active Directory Domain Services, see the topics Introduction to Active Directory Objects and Active Directory Technology Backgrounder, as well as the following topics in the MSDN library at http://msdn.microsoft.com/library:

Active Directory Domain Services use a tree structure. Each node in the tree contains a set of properties. Use this namespace to traverse, search, and modify the tree, and read and write to the properties of a node.

The DirectoryEntry class encapsulates a node or object in the Active Directory Domain Services hierarchy. Use this class for binding to objects, reading properties, and updating attributes. Together with helper classes, DirectoryEntry provides support for life-cycle management and navigation methods, including creating, deleting, renaming, moving a child node, and enumerating children.

Use the DirectorySearcher class to perform queries against the Active Directory Domain Services hierarchy. LDAP is the only system-supplied Active Directory Service Interfaces (ADSI) provider that supports searching.

A search of the Active Directory Domain Services hierarchy through DirectorySearcher returns instances of SearchResult, which are contained in an instance of the SearchResultCollection class.

  ClassDescription
Public classActiveDirectoryAccessRule The ActiveDirectoryAccessRule class is used to represent an access control entry (ACE) in the discretionary access control list (DACL) of an Active Directory Domain Services object.
Public classActiveDirectoryAuditRule The ActiveDirectoryAuditRule is used to set an access control entry (ACE) on a system access control list (SACL). The ActiveDirectoryAccessRule contains the trustee, which is represented as an IdentityReference object. It also contains information about the access control type, access mask, and other properties such as inheritance flags. This rule is set on an ActiveDirectorySecurity object. After the ActiveDirectorySecurity is committed to the directory store, it will modify the security descriptor object according to the rules that are set on ActiveDirectoryAuditRule.
Public classActiveDirectorySecurity Uses the object security layer of the managed ACL library to wrap access control functionality for directory objects.
Public classCreateChildAccessRule The CreateChildAccessRule class represents a specific type of access rule that is used to allow or deny an Active Directory Domain Services object the right to create child objects.
Public classDeleteChildAccessRule The DeleteChildAccessRule class represents a specific type of access rule that is used to allow or deny an Active Directory Domain Services object the right to delete child objects.
Public classDeleteTreeAccessRule The DeleteTreeAccessRule class represents a specific type of access rule that is used to allow or deny an Active Directory Domain Services object the right to delete all child objects, regardless of the permissions that the child objects have.
Public classDirectoryEntries Contains a collection of DirectoryEntry objects.
Public classDirectoryEntry The DirectoryEntry class encapsulates a node or object in the Active Directory Domain Services hierarchy.
Public classDirectoryEntryConfiguration The DirectoryEntryConfiguration class provides a direct way to specify and obtain provider-specific options for manipulating a directory object. Typically, the options apply to search operations of the underlying directory store. The supported options are provider-specific.
Public classDirectorySearcher Performs queries against Active Directory Domain Services.
Public classDirectoryServicesCOMException Contains extended error information about an error that occurred when the Invoke method is called.
Public classDirectoryServicesPermission The DirectoryServicesPermission class allows you to control code access security permissions for System.DirectoryServices.
Public classDirectoryServicesPermissionAttribute Allows declarative System.DirectoryServices permission checks.
Public classDirectoryServicesPermissionEntry The DirectoryServicesPermissionEntry class defines the smallest unit of a code access security permission set for System.DirectoryServices.
Public classDirectoryServicesPermissionEntryCollection Contains a strongly-typed collection of DirectoryServicesPermissionEntry objects.
Public classDirectorySynchronization Specifies how to synchronize a directory within a domain.
Public classDirectoryVirtualListView The DirectoryVirtualListView class specifies how to conduct a virtual list view search. A virtual list view search enables users to view search results as address-book style virtual list views. It is specifically designed for very large result sets. Search data is retrieved in contiguous subsets of a sorted directory search.
Public classDirectoryVirtualListViewContext Specifies how to construct directory virtual list view response.
Public classDSDescriptionAttribute Supports the .NET Framework infrastructure and is not intended to be used directly from code.
Public classExtendedRightAccessRule Represents a specific type of access rule that is used to allow or deny an Active Directory object an extended right. Extended rights are special operations that are not covered by the standard set of access rights. An example of an extended right is Send-As, which gives a user the right to send e-mail for another user. For a list of possible extended rights, see the topic Extended Rights in the MSDN Library at http://msdn.microsoft.com/library. For more information about extended rights, see the topic Control Access Rights, also in the MSDN Library.
Public classListChildrenAccessRule The ListChildrenAccessRule class represents a specific type of access rule that is used to allow or deny an Active Directory Domain Services object the right to list child objects.
Public classPropertyAccessRule The PropertyAccessRule class represents a specific type of access rule that is used to allow or deny access to an Active Directory Domain Services property.
Public classPropertyCollectionThe PropertyCollection class contains the properties of a DirectoryEntry.
Public classPropertySetAccessRule The PropertySetAccessRule class represents a specific type of access rule that is used to allow or deny access to an Active Directory Domain Services property set. For a list of property sets that are defined for Active Directory Domain Services, see the topic Property Sets in the MSDN Library at http://msdn.microsoft.com/library.
Public classPropertyValueCollection Contains the values of a DirectoryEntry property.
Public classResultPropertyCollection Contains the properties of a SearchResult instance.
Public classResultPropertyValueCollection Contains the values of a SearchResult property.
Public classSchemaNameCollectionContains a list of the schema names that the SchemaFilter property of a DirectoryEntries object can use.
Public classSearchResult The SearchResult class encapsulates a node in the Active Directory Domain Services hierarchy that is returned during a search through DirectorySearcher.
Public classSearchResultCollectionThe SearchResultCollection class contains the SearchResult instances that the Active Directory hierarchy returned during a DirectorySearcher query.
Public classSortOption Specifies how to sort the results of a search.
  EnumerationDescription
Public enumerationActiveDirectoryRights The ActiveDirectoryRights enumeration specifies the access rights that are assigned to an Active Directory Domain Services object.
Public enumerationActiveDirectorySecurityInheritance The ActiveDirectorySecurityInheritance enumeration specifies if, and how, ACE information is applied to an object and its descendents.
Public enumerationAuthenticationTypes The AuthenticationTypes enumeration specifies the types of authentication used in System.DirectoryServices. This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Public enumerationDereferenceAlias The DereferenceAlias enumeration specifies how aliases are resolved. This enumeration provides values for the DirectorySearcher..::.DerefAlias property.
Public enumerationDirectoryServicesPermissionAccess The DirectoryServicesPermissionAccess enumeration defines access levels that are used by System.DirectoryServices permission classes. This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.
Public enumerationDirectorySynchronizationOptions Contains flags that determine how directories within a domain will be synchronized. These options can be set for the DirectorySynchronization..::.Option property.
Public enumerationExtendedDN The ExtendedDN enumeration specifies the format in which to return the extended distinguished name. This enumeration is used with the DirectorySearcher..::.ExtendedDN property.
Public enumerationPasswordEncodingMethod Specifies whether SSL is used when you set or change a password. This enumeration is used with the DirectoryEntryConfiguration..::.PasswordEncoding property.
Public enumerationPropertyAccess The PropertyAccess enumeration is used with the PropertyAccessRule and PropertySetAccessRule classes to indicate the type of access that is applied to an Active Directory property or property set.
Public enumerationReferralChasingOption The ReferralChasingOption enumeration specifies if and how referral chasing is pursued.
Public enumerationSearchScope Specifies the possible scopes for a directory search that is performed using the DirectorySearcher object.
Public enumerationSecurityMasks Specifies the available options for examining security information of a directory object. This enumeration is used with the DirectorySearcher..::.SecurityMasks and DirectoryEntryConfiguration..::.SecurityMasks properties.
Public enumerationSortDirection The SortDirection enumeration specifies how to sort the results of an Active Directory Domain Services query.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
TOC on left is not correct.      ChadMentzer ... BruceOfTacoma   |   Edit   |   Show History
In IE7, the TOC on the left does not show many of the expected objects when I expand System.DirectoryServices Namespace. Instead, they are shown when I expand System.Diagnostics.SymbolStore Namespace. This may sound trivial, but can be confusing until it is understood.

RESPONSE: Yes, I saw these too. An error with MSDN that has been corrected.
Links redirect to "Not Found" page in Japanese      Baldrick99 ... BruceOfTacoma   |   Edit   |   Show History
The "more information" links ("Using Active Directory", "Active Directory Service Interfaces", etc.) after paragraph 4 are broken.

RESPONSE: These links have been reviewed and are currently working.
These pages suck - broken links and no decent source code samples      Julian Brown ... BruceOfTacoma   |   Edit   |   Show History
I searched through reams of MSDN pages to see how to use all this ADSI LDAP stuff but finding any decent code samples is almost impossible because of broken links and circularities that take you nowhere apart from boring and meaningless descriptions of endless objects.

RESPONSE: These links have been reviewed and are currently working.
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker