ディレクトリ オブジェクトを削除するために、DirectoryEntries クラスが Remove メソッドを提供しています。このメソッドは、現在の親 DirectoryEntry オブジェクトの Children コレクションから子エントリを削除します。このメソッドは、空のコンテナ、またはプリンタやコンピュータ ノードなどディレクトリ ツリーのコンテナとして使用されないオブジェクト上でのみ使用できます。子オブジェクトを持つコンテナの削除の詳細については、「オブジェクトのサブツリーの削除」を参照してください。
次の例は、ディレクトリからオブジェクトを削除する方法を示しています。
Dim entry As New DirectoryServices.DirectoryEntry("WinNT://DomainName")
Dim entryToRemove As DirectoryServices.DirectoryEntry
' Add code here to set entryToRemove to the entry you want to remove.
entry.Children.Remove(entryToRemove)
System.DirectoryServices.DirectoryEntry entry =
new System.DirectoryServices.DirectoryEntry("WinNT://DomainName");
System.DirectoryServices.DirectoryEntry entryToRemove = null;
// Add code here to set entryToRemove to the entry you want to remove.
entry.Children.Remove(entryToRemove);
関連項目
リファレンス
System.DirectoryServices
DirectoryEntry
DirectoryEntries
概念
オブジェクトの作成、削除、名前の変更、および移動
オブジェクトのサブツリーの削除
Send comments about this topic to Microsoft.
Copyright © 2007 by Microsoft Corporation. All rights reserved.