Share via


DirectoryEntry.CopyTo (DirectoryEntry)

The CopyTo method creates a copy of this entry as a child of the specified parent.

public DirectoryEntry CopyTo(
  DirectoryEntry newParent
);
Public Function CopyTo( _
  ByVal newParent As DirectoryEntry _
) As DirectoryEntry

Parameters

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

Return Values

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

Exceptions

Exception type Condition
InvalidOperationException The specified DirectoryEntry is not a container.

Security

Remarks

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

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

Requirements

Client Requires Windows XP Home Edition, Windows XP Professional, Windows Me, or Windows 98.
Server Requires Windows Server 2003, Windows 2000, or Windows NT 4.0.
Namespace

Defined in System.DirectoryServices.

Assembly

Requires System.DirectoryServices (in System.DirectoryServices.dll).

.NET Framework

Requires .NET Framework 1.0.

See Also

DirectoryEntry Class, DirectoryEntry Methods, DirectoryEntry Members (Visual J# Syntax), Managed Extensions for C++ Programming, System.DirectoryServices Namespace