指定したパスにある Active Directory のノードにバインドする DirectoryEntry クラスの新しいインスタンスを初期化します。
名前空間: System.DirectoryServices
アセンブリ: System.DirectoryServices (system.directoryservices.dll 内)
構文
'宣言
Public Sub New ( _
path As String _
)
'使用
Dim path As String
Dim instance As New DirectoryEntry(path)
public DirectoryEntry (
string path
)
public:
DirectoryEntry (
String^ path
)
public DirectoryEntry (
String path
)
public function DirectoryEntry (
path : String
)
パラメータ
- path
DirectoryEntry(String) をディレクトリにバインドするパス。Path プロパティは、この値に初期化されます。
使用例
DirectoryEntry オブジェクトを指定したパスのディレクトリ エントリにバインドし、そのノードの Children プロパティで指定される各子エントリの Path プロパティを出力するコード例を次に示します。
Public Class PrintChildren
'Entry point which delegates to C-style main Private Function.
Public Overloads Shared Sub Main()
Main(System.Environment.GetCommandLineArgs())
End Sub
Overloads Public Shared Sub Main(args() As String)
Dim objDE As DirectoryEntry
Dim strPath As String = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com"
If args.Length > 0 Then
strPath = args(1)
End If
' Create a new DirectoryEntry with the given path.
objDE = New DirectoryEntry(strPath)
Dim objChildDE As DirectoryEntry
For Each objChildDE In objDE.Children
Console.WriteLine(objChildDE.Path)
Next objChildDE
End Sub 'Main
End Class 'PrintChildren
public class PrintChildren{
public static void Main(String[] args)
{
DirectoryEntry objDE;
String strPath="LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
if(args.Length>0)strPath=args[1];
// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);
foreach(DirectoryEntry objChildDE in objDE.Children)
Console.WriteLine(objChildDE.Path);
}
}
int main()
{
String^ args[] = Environment::GetCommandLineArgs();
DirectoryEntry^ objDE;
String^ strPath = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
if(args->Length>1)
{
strPath=args[1];
}
// Create a new DirectoryEntry with the given path.
objDE = gcnew DirectoryEntry(strPath);
System::Collections::IEnumerator^ enum0 = objDE->Children->GetEnumerator();
while (enum0->MoveNext())
{
DirectoryEntry^ objChildDE = safe_cast<DirectoryEntry^>(enum0->Current);
Console::WriteLine(objChildDE->Path);
}
}
.NET Framework のセキュリティ
プラットフォーム
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
バージョン情報
.NET Framework
サポート対象 : 2.0、1.1、1.0
参照
関連項目
DirectoryEntry クラス
DirectoryEntry メンバ
System.DirectoryServices 名前空間