Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
CopyTo Method

SPFolder.CopyTo Method

Copies the folder and its contents into a new folder at the specified URL.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

public void CopyTo(
	string strNewUrl


Type: System.String

A string that specifies the URL for the new folder.

The CopyTo method applies only to the context of a single site.

The following code example copies a specified subfolder from the Shared Documents document library to a new subfolder in another document library.

SPWeb oWebsite = SPContext.Current.Web;
if (oWebsite.GetFolder("Shared Documents/Source_Subfolder_Name").Exists)
    SPFolder oFolderSrc = oWebsite.GetFolder("Shared Documents/Source_Subfolder_Name");
© 2015 Microsoft