DirectoryEntry.Exists(String) メソッド

定義

指定したパスがディレクトリ サービスの実際のエントリを表しているかどうかを判断します。

public:
 static bool Exists(System::String ^ path);
public static bool Exists (string path);
static member Exists : string -> bool
Public Shared Function Exists (path As String) As Boolean

パラメーター

path
String

確認するエントリのパス。

戻り値

指定したパスがディレクトリ サービスの有効なエントリを表している場合は true。それ以外の場合は false

次の例では、1 つの引数を受け取り、パスが有効な DirectoryEntryに対応しているかどうかを判断します。

Dim myADSPath As String = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com"  
' Determine whether the given path is correct for the DirectoryEntry.  
If DirectoryEntry.Exists(myADSPath) Then  
   Console.WriteLine("The path {0} is valid",myADSPath)  
Else  
   Console.WriteLine("The path {0} is invalid",myADSPath)  
End If  
string myADSPath ="LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";  

// Determine whether the given path is correct for the DirectoryEntry.  
if (DirectoryEntry.Exists(myADSPath))  
{  
    Console.WriteLine("The path {0} is valid",myADSPath);  
}  
    else  
{  
    Console.WriteLine("The path {0} is invalid",myADSPath);  
}  
String^ myADSPath = "LDAP://onecity/CN=Users,DC=onecity,DC=corp,DC=fabrikam,DC=com";  
// Determine whether the given path is correct for the DirectoryEntry.  
if (DirectoryEntry::Exists(myADSPath))   
{  
    Console::WriteLine("The path {0} is valid", myADSPath);  
}   
else   
{  
    Console::WriteLine("The path {0} is invalid", myADSPath);  
}  

適用対象