Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
SchemaEntry Property

DirectoryEntry.SchemaEntry Property

Gets the DirectoryEntry that holds schema information for this entry. An entry's schema determines a list of its mandatory and optional property names.

[Visual Basic]
Public ReadOnly Property SchemaEntry As DirectoryEntry
public DirectoryEntry SchemaEntry {get;}
public: __property DirectoryEntry* get_SchemaEntry();
public function get SchemaEntry() : DirectoryEntry;

Property Value

The DirectoryEntry that holds schema information for this entry.


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


[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
   Next myChildDirectoryEntry
End If 

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)

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);

[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.


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 | SchemaClassName

© 2015 Microsoft