Partager via


MoveTo(String) Method

The MoveTo method of the SPFile class moves the file to the destination URL but does not overwrite an existing file of the same name.

Parameters

strNewUrl   A string that specifies the destination URL.

Remarks

The MoveTo method is used to move files to another location within the same site.

This method returns an error if a file of the same name already exists at the new location.

Example

The following code example moves files older than a specified date from one folder to another folder.

This example requires using directives (Imports in Visual Basic) for both the Microsoft.SharePoint and Microsoft.SharePoint.WebControls namespaces.

Requirements

Platforms: Microsoft Windows Server 2003

Security: Code Access Security