DirectoryEntry.Exists(String) Methode

Definitie

Bepaalt of het opgegeven pad een werkelijke vermelding in de adreslijstservice vertegenwoordigt.

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

Parameters

path
String

Het pad van de vermelding die moet worden geverifieerd.

Retouren

true als het opgegeven pad een geldige vermelding in de adreslijstservice vertegenwoordigt; anders, false.

Voorbeelden

In het volgende voorbeeld wordt één argument gebruikt en wordt bepaald of het pad overeenkomt met een geldig DirectoryEntrypad.

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

Van toepassing op