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.

C#
[Windows.Foundation.Metadata.Overload("MoveOverloadDefaultNameAndOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction MoveAsync(IStorageFolder destinationFolder);

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

WinRT Build 26100 and other versions
Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

MoveAsync(IStorageFolder, String)

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

C#
[Windows.Foundation.Metadata.Overload("MoveOverloadDefaultOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction MoveAsync(IStorageFolder destinationFolder, string desiredNewName);

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

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)
Attributes

See also

Applies to

WinRT Build 26100 and other versions
Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100

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.

C#
[Windows.Foundation.Metadata.Overload("MoveOverload")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction MoveAsync(IStorageFolder destinationFolder, string desiredNewName, NameCollisionOption option);

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

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)
Attributes

See also

Applies to

WinRT Build 26100 and other versions
Product Versions
WinRT Build 10240, Build 10586, Build 14383, Build 15063, Build 16299, Build 17134, Build 17763, Build 18362, Build 19041, Build 20348, Build 22000, Build 22621, Build 26100