This documentation is archived and is not being maintained.

Quick List for C# Code Examples 

This topic contains links to all of the C# code examples contained in the System.DirectoryServices Using guide.

Creating Groups

Using the Add method.

Adding Directory Objects

Using the Add method to add child objects.

Adding Members to a Group

Using the Add method.

Binding Strings

Using the DirectoryEntry object to bind to objects.

Binding Using GUID

Using the NativeGuid property.

Boolean Property Type

Reading and setting a Boolean property using the Value property.

Managing User Passwords

Changing user passwords.

Constructed Properties

Reading and writing constructed properties.

DirectoryEntry Objects

Creating a DirectoryEntry object in memory that binds to an entry in the directory, and writing the path, name, and GUID for that directory entry.

Creating Groups

Creating a new group, domain local group, and non-secure group.

Creating Users

Using the Add method.

DateTime Property

Writing the date/time property.

Deleting Groups

Using the Remove method.

DirectorySearcher Example

Setting up a basic directory search.

DN with Binary Property Type

Reading and writing using ActiveDS.

Enumerating Child Objects

Using a simple foreach statement.

Enumerating Members of a Group

Using Properties.

Enumerating Members of a Group

Using a Windows form.

Enumerating Members in a Large Group

Using range retrieval.

Getting an Object's Identity

Getting the properties for the DirectoryEntry object.

Invoking ADSI Methods

Using the Invoke method.

Invoking ADSI Properties

Using the InvokeMember method.

Large Integer Property Type

Reading and writing large integers.

Moving Directory Objects

Using the MoveTo method.

Navigating to the Child Object

Using the Children property to bind to child objects.

Navigating to the Parent Object

Using the Parent property to bind to parent objects.

Octet String (SID) Property Type

Reading and writing octet strings.

Reading Properties on Directory Objects

Using the Properties collection to read object properties.

Reading Properties with Multiple Values

Using the Values property and arrays to read property values.

Setting Properties on Directory Objects

Using the Setting properties with the Add method and Value property.

Setting Properties with Multiple Values

Using the AddRange and Insert methods and using arrays.

The Property Cache

Using the RefreshCache method.

Removing Members from a Group

Using the Add method.

Renaming an Object

Using the Rename property.

Searching for Groups

Using DirectorySearcher.

Additional Search Options

Using the ReferralChasing property.

Getting Search Results

Using SearchResult and SearchResultCollection classes to retrieve search results.

Searching the Directory

Using the DirectorySearcher class with the FindAll method to search the directory.

Setting Search Filters

Using the Filter property to set a search filter.

Setting the Search Scope

Using the SearchScope property.

Security Descriptor Property Type

Reading and writing security descriptors using ActiveDS.

Managing User Passwords

Setting user passwords.

String Property Type

Reading strings.

Enabling and Disabling the User Account

Enabling and disabling user accounts.

Managing User Passwords

Using ActiveDS.

Setting a User Account Expiration

Using the InvokeMember method.

Setting User Account Flags

Setting flags.

Setting Properties Displayed on Property Pages

Setting properties that are viewed in the user interface.

Adding Directory Objects

Using the Exists method to verify that a directory object exists in the directory.

Show: