StorageFile.RenameAsync Method
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
RenameAsync(String) |
Renames the current file. |
RenameAsync(String, NameCollisionOption) |
Renames the current file. This method also specifies what to do if an existing item in the current file's location has the same name. |
Renames the current file.
public:
virtual IAsyncAction ^ RenameAsync(Platform::String ^ desiredName) = RenameAsync;
/// [Windows.Foundation.Metadata.Overload("RenameAsyncOverloadDefaultOptions")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction RenameAsync(winrt::hstring const& desiredName);
[Windows.Foundation.Metadata.Overload("RenameAsyncOverloadDefaultOptions")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction RenameAsync(string desiredName);
function renameAsync(desiredName)
Public Function RenameAsync (desiredName As String) As IAsyncAction
Parameters
- desiredName
-
String
Platform::String
winrt::hstring
The desired, new name of the current item.
Returns
No object or value is returned by this method when it completes.
Implements
- Attributes
Remarks
If the name you specify is invalid, this method throws an exception. To handle all the ways the specified name could be invalid, you must catch all four of these exceptions:
E_INVALIDARG |
E_FAIL |
ERROR_FILENAME_EXCED_RANGE |
ERROR_INVALID_NAME |
If the file is deleted before the rename finishes, this method throws the ERROR_FILE_NOT_FOUND exception. You must also catch and handle this exception when you use this method.
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 |
Renames the current file. This method also specifies what to do if an existing item in the current file's location has the same name.
public:
virtual IAsyncAction ^ RenameAsync(Platform::String ^ desiredName, NameCollisionOption option) = RenameAsync;
/// [Windows.Foundation.Metadata.Overload("RenameAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncAction RenameAsync(winrt::hstring const& desiredName, NameCollisionOption const& option);
[Windows.Foundation.Metadata.Overload("RenameAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncAction RenameAsync(string desiredName, NameCollisionOption option);
function renameAsync(desiredName, option)
Public Function RenameAsync (desiredName As String, option As NameCollisionOption) As IAsyncAction
Parameters
- desiredName
-
String
Platform::String
winrt::hstring
The desired, new name of the current file.
If there is an existing item in the current file's location that already has the specified desiredName, the specified NameCollisionOption determines how Windows responds to the conflict.
- option
- NameCollisionOption
The enum value that determines how Windows responds if the desiredName is the same as the name of an existing item in the current file's location.
Returns
No object or value is returned by this method when it completes.
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 |