DirectoryEntry Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the DirectoryEntry class.
Overloads
DirectoryEntry() |
Initializes a new instance of the DirectoryEntry class. |
DirectoryEntry(Object) |
Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object. |
DirectoryEntry(String) |
Initializes a new instance of the DirectoryEntry class that binds this instance to the node in Active Directory Domain Services located at the specified path. |
DirectoryEntry(String, String, String) |
Initializes a new instance of the DirectoryEntry class. |
DirectoryEntry(String, String, String, AuthenticationTypes) |
Initializes a new instance of the DirectoryEntry class. |
DirectoryEntry()
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
Initializes a new instance of the DirectoryEntry class.
public:
DirectoryEntry();
public DirectoryEntry ();
Public Sub New ()
Applies to
DirectoryEntry(Object)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
Initializes a new instance of the DirectoryEntry class that binds to the specified native Active Directory Domain Services object.
public:
DirectoryEntry(System::Object ^ adsObject);
public DirectoryEntry (object adsObject);
new System.DirectoryServices.DirectoryEntry : obj -> System.DirectoryServices.DirectoryEntry
Public Sub New (adsObject As Object)
Parameters
- adsObject
- Object
The name of the native Active Directory Domain Services object to bind to.
Remarks
This constructor enables a program to use the methods and properties of the DirectoryEntry class on a native Active Directory Domain Services object that implements the IADs interface through a native API. For more information about the IADs interface, see the IADs article.
Applies to
DirectoryEntry(String)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
Initializes a new instance of the DirectoryEntry class that binds this instance to the node in Active Directory Domain Services located at the specified path.
public:
DirectoryEntry(System::String ^ path);
public DirectoryEntry (string? path);
public DirectoryEntry (string path);
new System.DirectoryServices.DirectoryEntry : string -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String)
Parameters
- path
- String
The path at which to bind the DirectoryEntry(String) to the directory. The Path property is initialized to this value.
Examples
The following example binds a DirectoryEntry object to the directory entry at the specified path, and displays the Path property of each child entry that is specified by the node's Children property.
Public Class PrintChildren
'Entry point which delegates to C-style main Private Function.
Public Overloads Shared Sub Main()
Main(System.Environment.GetCommandLineArgs())
End Sub
Overloads Public Shared Sub Main(args() As String)
Dim objDE As DirectoryEntry
Dim strPath As String = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com"
If args.Length > 0 Then
strPath = args(1)
End If
' Create a new DirectoryEntry with the given path.
objDE = New DirectoryEntry(strPath)
Dim objChildDE As DirectoryEntry
For Each objChildDE In objDE.Children
Console.WriteLine(objChildDE.Path)
Next objChildDE
End Sub 'Main
End Class 'PrintChildren
public class PrintChildren{
public static void Main(String[] args)
{
DirectoryEntry objDE;
String strPath="LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
if(args.Length>0)strPath=args[1];
// Create a new DirectoryEntry with the given path.
objDE=new DirectoryEntry(strPath);
foreach(DirectoryEntry objChildDE in objDE.Children)
Console.WriteLine(objChildDE.Path);
}
}
int main()
{
String^ args[] = Environment::GetCommandLineArgs();
DirectoryEntry^ objDE;
String^ strPath = "LDAP://DC=onecity,DC=corp,DC=fabrikam,DC=com";
if(args->Length>1)
{
strPath=args[1];
}
// Create a new DirectoryEntry with the given path.
objDE = gcnew DirectoryEntry(strPath);
System::Collections::IEnumerator^ enum0 = objDE->Children->GetEnumerator();
while (enum0->MoveNext())
{
DirectoryEntry^ objChildDE = safe_cast<DirectoryEntry^>(enum0->Current);
Console::WriteLine(objChildDE->Path);
}
}
Applies to
DirectoryEntry(String, String, String)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
Initializes a new instance of the DirectoryEntry class.
public:
DirectoryEntry(System::String ^ path, System::String ^ username, System::String ^ password);
public DirectoryEntry (string? path, string? username, string? password);
public DirectoryEntry (string path, string username, string password);
new System.DirectoryServices.DirectoryEntry : string * string * string -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String, username As String, password As String)
Parameters
- path
- String
The path of this DirectoryEntry. The Path property is initialized to this value.
- username
- String
The user name to use when authenticating the client. The Username property is initialized to this value.
- password
- String
The password to use when authenticating the client. The Password property is initialized to this value.
Applies to
DirectoryEntry(String, String, String, AuthenticationTypes)
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
- Source:
- DirectoryEntry.cs
Initializes a new instance of the DirectoryEntry class.
public:
DirectoryEntry(System::String ^ path, System::String ^ username, System::String ^ password, System::DirectoryServices::AuthenticationTypes authenticationType);
public DirectoryEntry (string? path, string? username, string? password, System.DirectoryServices.AuthenticationTypes authenticationType);
public DirectoryEntry (string path, string username, string password, System.DirectoryServices.AuthenticationTypes authenticationType);
new System.DirectoryServices.DirectoryEntry : string * string * string * System.DirectoryServices.AuthenticationTypes -> System.DirectoryServices.DirectoryEntry
Public Sub New (path As String, username As String, password As String, authenticationType As AuthenticationTypes)
Parameters
- path
- String
The path of this DirectoryEntry. The Path property is initialized to this value.
- username
- String
The user name to use when authenticating the client. The Username property is initialized to this value.
- password
- String
The password to use when authenticating the client. The Password property is initialized to this value.
- authenticationType
- AuthenticationTypes
One of the AuthenticationTypes values. The AuthenticationType property is initialized to this value.