DirectoryEntry.SchemaEntry 属性

定义

获取此项的架构对象。

public:
 property System::DirectoryServices::DirectoryEntry ^ SchemaEntry { System::DirectoryServices::DirectoryEntry ^ get(); };
public System.DirectoryServices.DirectoryEntry SchemaEntry { get; }
[System.ComponentModel.Browsable(false)]
[System.DirectoryServices.DSDescription("DSSchemaEntry")]
public System.DirectoryServices.DirectoryEntry SchemaEntry { get; }
member this.SchemaEntry : System.DirectoryServices.DirectoryEntry
[<System.ComponentModel.Browsable(false)>]
[<System.DirectoryServices.DSDescription("DSSchemaEntry")>]
member this.SchemaEntry : System.DirectoryServices.DirectoryEntry
Public ReadOnly Property SchemaEntry As DirectoryEntry

属性值

一个 DirectoryEntry 对象,表示此项的架构类。

属性

示例

以下示例演示 SchemaClassName 类的 DirectoryEntrySchemaEntry 属性。 此示例获取用户指定的 DirectoryEntry 对象,如果对象是容器对象,则 SchemaEntry 获取其所有子对象。 SchemaEntry如果对象的 是Name“container”,则 为容器对象。

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, UserName, SecurelyStoredPassword)  

' 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  
String myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";  

// Creates an Instance of DirectoryEntry.  
DirectoryEntry  myDirectoryEntry=new DirectoryEntry(myADSPath, UserName, SecurelyStoredPassword);  

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

注解

条目的架构确定其必需和可选属性名称的列表。

可以使用此属性来查找关联对象上可用的属性和方法。

适用于

另请参阅