Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

SPFile.MoveTo method (String, SPMoveOperations)

Moves the file to the specified destination URL based on the type of operation that is specified.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
[ClientCallableExceptionConstraintAttribute(FixedId = "7", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "The file is not locked")]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "There is a shared lock on the file")]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorType = typeof(SPFileLockException), 
	ErrorCode = , Condition = "There is an exclusive lock on the file")]
public void MoveTo(
	string newUrl,
	SPMoveOperations flags


Type: System.String

A string that specifies the destination URL.

Type: Microsoft.SharePoint.SPMoveOperations

An enumeration value that specifies the type of move operation; for example, whether to complete the operation when supporting files are absent, or whether to overwrite a file with the same name.


The value of the flags is not valid.

The flags can only be set to BypassApprovePermission, Overwrite, AllowBrokenThickets, or the result of a bitwise OR operation between them.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.