Share via


StorageFile.MoveAsync Method

Definition

Overloads

MoveAsync(IStorageFolder)

Moves the current file to the specified folder.

MoveAsync(IStorageFolder, String)

Moves the current file to the specified folder and renames the file according to the desired name.

MoveAsync(IStorageFolder, String, NameCollisionOption)

Moves the current file to the specified folder and renames the file according to the desired name. This method also specifies what to do if a file with the same name already exists in the specified folder.

MoveAsync(IStorageFolder)

Moves the current file to the specified folder.

public:
 virtual IAsyncAction ^ MoveAsync(IStorageFolder ^ destinationFolder) = MoveAsync;
/// [Windows.Foundation.Metadata.Overload("MoveOverloadDefaultNameAndOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction MoveAsync(IStorageFolder const& destinationFolder);
[Windows.Foundation.Metadata.Overload("MoveOverloadDefaultNameAndOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction MoveAsync(IStorageFolder destinationFolder);
function moveAsync(destinationFolder)
Public Function MoveAsync (destinationFolder As IStorageFolder) As IAsyncAction

Parameters

destinationFolder
IStorageFolder

The destination folder where the file is moved.

This destination folder must be a physical location. Otherwise, if the destination folder exists only in memory, like a file group, this method fails and throws a System.Exception with the following message: Value does not fall within the expected range.

Returns

No object or value is returned by this method.

Implements

Attributes

See also

Applies to

MoveAsync(IStorageFolder, String)

Moves the current file to the specified folder and renames the file according to the desired name.

public:
 virtual IAsyncAction ^ MoveAsync(IStorageFolder ^ destinationFolder, Platform::String ^ desiredNewName) = MoveAsync;
/// [Windows.Foundation.Metadata.Overload("MoveOverloadDefaultOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction MoveAsync(IStorageFolder const& destinationFolder, winrt::hstring const& desiredNewName);
[Windows.Foundation.Metadata.Overload("MoveOverloadDefaultOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction MoveAsync(IStorageFolder destinationFolder, string desiredNewName);
function moveAsync(destinationFolder, desiredNewName)
Public Function MoveAsync (destinationFolder As IStorageFolder, desiredNewName As String) As IAsyncAction

Parameters

destinationFolder
IStorageFolder

The destination folder where the file is moved.

This destination folder must be a physical location. Otherwise, if the destination folder exists only in memory, like a file group, this method fails and throws a System.Exception with the following message: Value does not fall within the expected range.

desiredNewName
String

Platform::String

winrt::hstring

The desired name of the file after it is moved.

If there is an existing file in the destination folder that already has the specified desiredNewName, Windows generates a unique name for the file.

Returns

No object or value is returned by this method.

Implements

M:Windows.Storage.IStorageFile.MoveAsync(Windows.Storage.IStorageFolder,System.String) M:Windows.Storage.IStorageFile.MoveAsync(Windows.Storage.IStorageFolder,Platform::String) M:Windows.Storage.IStorageFile.MoveAsync(Windows.Storage.IStorageFolder,winrt::hstring)
Attributes

See also

Applies to

MoveAsync(IStorageFolder, String, NameCollisionOption)

Moves the current file to the specified folder and renames the file according to the desired name. This method also specifies what to do if a file with the same name already exists in the specified folder.

public:
 virtual IAsyncAction ^ MoveAsync(IStorageFolder ^ destinationFolder, Platform::String ^ desiredNewName, NameCollisionOption option) = MoveAsync;
/// [Windows.Foundation.Metadata.Overload("MoveOverload")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction MoveAsync(IStorageFolder const& destinationFolder, winrt::hstring const& desiredNewName, NameCollisionOption const& option);
[Windows.Foundation.Metadata.Overload("MoveOverload")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction MoveAsync(IStorageFolder destinationFolder, string desiredNewName, NameCollisionOption option);
function moveAsync(destinationFolder, desiredNewName, option)
Public Function MoveAsync (destinationFolder As IStorageFolder, desiredNewName As String, option As NameCollisionOption) As IAsyncAction

Parameters

destinationFolder
IStorageFolder

The destination folder where the file is moved.

This destination folder must be a physical location. Otherwise, if the destination folder exists only in memory, like a file group, this method fails and throws a System.Exception with the following message: Value does not fall within the expected range.

desiredNewName
String

Platform::String

winrt::hstring

The desired name of the file after it is moved.

If there is an existing file in the destination folder that already has the specified desiredNewName, the specified NameCollisionOption determines how Windows responds to the conflict.

option
NameCollisionOption

An enum value that determines how Windows responds if the desiredNewName is the same as the name of an existing file in the destination folder.

Returns

No object or value is returned by this method.

Implements

M:Windows.Storage.IStorageFile.MoveAsync(Windows.Storage.IStorageFolder,System.String,Windows.Storage.NameCollisionOption) M:Windows.Storage.IStorageFile.MoveAsync(Windows.Storage.IStorageFolder,Platform::String,Windows.Storage.NameCollisionOption) M:Windows.Storage.IStorageFile.MoveAsync(Windows.Storage.IStorageFolder,winrt::hstring,Windows.Storage.NameCollisionOption)
Attributes

See also

Applies to