DirectoryEntry.SchemaEntry Property


Gets the schema object for this entry.

Namespace:   System.DirectoryServices
Assembly:  System.DirectoryServices (in System.DirectoryServices.dll)

public DirectoryEntry SchemaEntry { get; }

Property Value

Type: System.DirectoryServices.DirectoryEntry

A DirectoryEntry object that represents the schema class for this entry.

An entry's schema determines a list of its mandatory and optional property names.

You can use this property to find out what properties and methods are available on the associated object.

The following example demonstrates the SchemaClassName and SchemaEntry properties of the DirectoryEntry class. This example gets the user-specified DirectoryEntry object and gets all of its children if the SchemaEntry object is a container object. The SchemaEntry is a container object if the Name of that object is "container".

String myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";

// Creates an Instance of DirectoryEntry.
DirectoryEntry  myDirectoryEntry=new DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);

// Display the 'SchemaClassName'.
Console.WriteLine("Schema class name:"+myDirectoryEntry.SchemaClassName);

// Gets the SchemaEntry of the ADS object.
DirectoryEntry mySchemaEntry = myDirectoryEntry.SchemaEntry;

if (string.Compare(mySchemaEntry.Name,"container") == 0)
   foreach(DirectoryEntry myChildDirectoryEntry in myDirectoryEntry.Children)


To get the schema object.

.NET Framework
Available since 1.1
Return to top