Export (0) Print
Expand All

DirectoryEntry.SchemaClassName Property

Gets the name of the schema used for this DirectoryEntry.

[Visual Basic]
Public ReadOnly Property SchemaClassName As String
[C#]
public string SchemaClassName {get;}
[C++]
public: __property String* get_SchemaClassName();
[JScript]
public function get SchemaClassName() : String;

Property Value

The name of the schema used for this DirectoryEntry.

Remarks

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

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

Example

[Visual Basic, C#, C++] The following sample demonstrates the SchemaClassName and SchemaEntry properties of the DirectoryEntry class. This example gets the user-specified DirectoryEntry and gets all it's Children if it's SchemaEntry is of type container.

[Visual Basic] 
Dim myADSPath As String = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"

' Creates an Instance of DirectoryEntry.
Dim myDirectoryEntry As New DirectoryEntry(myADSPath, "user", "password")

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

' Gets the SchemaEntry of the ADS object.
Dim mySchemaEntry As DirectoryEntry = myDirectoryEntry.SchemaEntry

If String.Compare(mySchemaEntry.Name, "container") = 0 Then
   Dim myChildDirectoryEntry As DirectoryEntry
   For Each myChildDirectoryEntry In  myDirectoryEntry.Children
      Console.WriteLine(myChildDirectoryEntry.Path)
   Next myChildDirectoryEntry
End If 

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

// Creates an Instance of DirectoryEntry.
DirectoryEntry  myDirectoryEntry=new DirectoryEntry(myADSPath,"user","password");

// 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)
      Console.WriteLine(myChildDirectoryEntry.Path);
}

[C++] 
String* myADSPath = S"LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";

// Creates an Instance of DirectoryEntry.
DirectoryEntry* myDirectoryEntry = new DirectoryEntry(myADSPath, S"user", S"password");

// Display the 'SchemaClassName'.
Console::WriteLine(S"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 = __try_cast<DirectoryEntry*>(myEnum->Current);
        Console::WriteLine(myChildDirectoryEntry->Path);
    }
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

DirectoryEntry Class | DirectoryEntry Members | System.DirectoryServices Namespace | Name | SchemaEntry

Show:
© 2015 Microsoft