DirectoryEntry.Exists(String) Methode

Definition

Bestimmt, ob der angegebene Pfad einen tatsächlichen Eintrag im Verzeichnisdienst darstellt.

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

Parameter

path
String

Der Pfad des zu überprüfenden Eintrags.

Gibt zurück

true, wenn der angegebene Pfad einen gültigen Eintrag im Verzeichnisdienst darstellt, andernfalls false.

Beispiele

Im folgenden Beispiel wird ein Argument verwendet und bestimmt, ob der Pfad einem gültigen DirectoryEntryentspricht.

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);  
}  

Gilt für: