Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
strNewUrl A string that specifies the destination URL.
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.
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.
Platforms: Microsoft Windows Server 2003
Security: Code Access Security