Export (0) Print
Expand All

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
[C#]
public DirectoryEntry SchemaEntry {get;}
[C++]
public: __property DirectoryEntry* get_SchemaEntry();
[JScript]
public function get SchemaEntry() : DirectoryEntry;

Property Value

The DirectoryEntry that holds schema information for this entry.

Remarks

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

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

Show:
© 2014 Microsoft