DirectoryEntry.CopyTo Method (DirectoryEntry, String)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Creates a copy of this DirectoryEntry object, as a child of the specified parent DirectoryEntry object, with the specified new name.

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

public DirectoryEntry CopyTo(
	DirectoryEntry newParent,
	string newName


Type: System.DirectoryServices.DirectoryEntry

The DN of the DirectoryEntry object that will be the parent for the copy that is being created.

Type: System.String

The name of the copy of this entry.

Return Value

Type: System.DirectoryServices.DirectoryEntry

A renamed copy of this entry as a child of the specified parent.

Exception Condition

The specified DirectoryEntry object is not a container.

The Lightweight Directory Access Protocol (LDAP) provider does not currently support this method.

If UsePropertyCache is true, call CommitChanges on the new object to make the copy permanent.


To make a copy of the entry.

.NET Framework
Available since 1.1
Return to top