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)


Public Sub MoveTo ( _
    newUrl As String, _
    flags As SPMoveOperations _
Dim instance As SPFile
Dim newUrl As String
Dim flags As SPMoveOperations

instance.MoveTo(newUrl, flags)
public void MoveTo(
    string newUrl,
    SPMoveOperations flags


  • newUrl
    Type: System.String

    A string that specifies the destination URL.

  • flags
    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.


Exception Condition

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.

See also


SPFile class

SPFile members

MoveTo overload

Microsoft.SharePoint namespace