Język

DirectoryEntry.Exists(String) Metoda

Definicja

Określa, czy określona ścieżka reprezentuje rzeczywisty wpis w usłudze katalogowej.

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

Parametry

path
String

Ścieżka wpisu do zweryfikowania.

Zwraca

true jeśli określona ścieżka reprezentuje prawidłowy wpis w usłudze katalogowej; w przeciwnym razie, false.

Przykłady

Poniższy przykład przyjmuje jeden argument i określa, czy ścieżka odpowiada prawidłowemu DirectoryEntryelementowi .

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

Dotyczy