Freigeben über


DirectoryEntry.Exists-Methode

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

Namespace: System.DirectoryServices
Assembly: System.DirectoryServices (in system.directoryservices.dll)

Syntax

'Declaration
Public Shared Function Exists ( _
    path As String _
) As Boolean
'Usage
Dim path As String
Dim returnValue As Boolean

returnValue = DirectoryEntry.Exists(path)
public static bool Exists (
    string path
)
public:
static bool Exists (
    String^ path
)
public static boolean Exists (
    String path
)
public static function Exists (
    path : String
) : boolean

Parameter

  • path
    Der Pfad des zu überprüfenden Eintrags.

Rückgabewert

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

Beispiel

Im folgenden Beispiel wird ein Argument übergeben und bestimmt, ob der Pfad einem gültigen DirectoryEntry entspricht.

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

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

DirectoryEntry-Klasse
DirectoryEntry-Member
System.DirectoryServices-Namespace