共用方式為


DirectoryEntry.SchemaClassName 屬性

定義

取得這個 DirectoryEntry 物件的結構描述類別名稱。

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

屬性值

這個 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, "container"))   
{  
    Collections::IEnumerator^ myEnum = myDirectoryEntry->Children->GetEnumerator();  
    while (myEnum->MoveNext())   
    {  
        DirectoryEntry^ myChildDirectoryEntry = safe_cast<DirectoryEntry^>(myEnum->Current);  
        Console::WriteLine(myChildDirectoryEntry->Path);  
    }  
}  

備註

這與 Name 屬性的 SchemaEntry 屬性相同。

DirectoryEntry對象的架構會定義其屬性和方法。

適用於

另請參閱