DirectoryEntry.SchemaEntry DirectoryEntry.SchemaEntry DirectoryEntry.SchemaEntry DirectoryEntry.SchemaEntry Property

定義

取得這個項目的結構描述物件。Gets the schema object for this entry.

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

屬性值

DirectoryEntry 物件,表示這個項目的結構描述類別。A DirectoryEntry object that represents the schema class for this entry.

範例

下列範例示範SchemaClassName DirectoryEntry類別的和SchemaEntry屬性。The following example demonstrates the SchemaClassName and SchemaEntry properties of the DirectoryEntry class. 這個範例會取得使用者指定DirectoryEntry的物件,並取得其所有子系( SchemaEntry如果物件是容器物件的話)。This example gets the user-specified DirectoryEntry object and gets all of its children if the SchemaEntry object is a container object. 如果該物件的為 "container",則是容器物件。SchemaEntry NameThe SchemaEntry is a container object if the Name of that object is "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);  
    }  
}  

備註

專案的架構會決定其必要和選擇性屬性名稱的清單。An entry's schema determines a list of its mandatory and optional property names.

您可以使用這個屬性來找出相關聯物件上可用的屬性和方法。You can use this property to find out what properties and methods are available on the associated object.

安全性

DirectoryServicesPermission
以取得架構物件。To get the schema object.

適用於

另請參閱