DirectoryEntry::SchemaClassName Property

Gets the name of the schema class for this DirectoryEntry object.

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

[BrowsableAttribute(false)]
[DSDescriptionAttribute(L"DSSchemaClassName")]
public:
property String^ SchemaClassName {
	String^ get ();
}

Property Value

Type: System::String
The name of the schema class for this DirectoryEntry object.

This is the same as the Name property of the SchemaEntry property.

A DirectoryEntry object's schema defines its properties and methods.

The following example demonstrates the SchemaClassName and SchemaEntry properties of the DirectoryEntry class. This example gets the user-specified DirectoryEntry and gets all of its children if the SchemaEntry 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, "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.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft