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)

Syntax

'Declaration
Public Sub MoveTo ( _
    newUrl As String, _
    flags As SPMoveOperations _
)
'Usage
Dim instance As SPFile
Dim newUrl As String
Dim flags As SPMoveOperations

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

Parameters

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

Exceptions

Exception Condition
ArgumentException

The value of the flags is not valid.

Remarks

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

See also

Reference

SPFile class

SPFile members

MoveTo overload

Microsoft.SharePoint namespace