次の方法で共有


DirectoryEntry.SchemaClassName プロパティ

DirectoryEntry で使用するスキーマの名前を取得します。

Public ReadOnly Property SchemaClassName As String
[C#]
public string SchemaClassName {get;}
[C++]
public: __property String* get_SchemaClassName();
[JScript]
public function get SchemaClassName() : String;

プロパティ値

DirectoryEntry で使用するスキーマの名前。

解説

これは SchemaEntry プロパティの Name プロパティと同じです。

DirectoryEntry オブジェクトのスキーマは、そのプロパティとメソッドを定義します。

使用例

[Visual Basic, C#, C++] DirectoryEntry クラスの SchemaClassName プロパティと SchemaEntry プロパティの例を次に示します。この例では、ユーザーが指定した DirectoryEntry を取得し、その SchemaEntry の種類が container である場合はそのすべての Children も取得します。

 
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] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

.NET Framework セキュリティ:

参照

DirectoryEntry クラス | DirectoryEntry メンバ | System.DirectoryServices 名前空間 | Name | SchemaEntry