This documentation is archived and is not being maintained.

DirectoryEntry::SchemaEntry Property

Gets the schema object for this entry.

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

[DSDescriptionAttribute(L"DSSchemaEntry")]
[BrowsableAttribute(false)]
public:
property DirectoryEntry^ SchemaEntry {
	DirectoryEntry^ 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 = gcnew DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);

// Display the 'SchemaClassName'.
Console::WriteLine("Schema class name:{0}", myDirectoryEntry->SchemaClassName);

// Gets the SchemaEntry of the ADS Object*.
DirectoryEntry^ mySchemaEntry = myDirectoryEntry->SchemaEntry;

if (!String::Compare(mySchemaEntry->Name, S"container")) 
{
    Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();
    while (myEnum->MoveNext()) 
    {
        DirectoryEntry^ myChildDirectoryEntry = safe_cast<DirectoryEntry^>(myEnum->Current);
        Console::WriteLine(myChildDirectoryEntry->Path);
    }
}

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: