DownloadsFolder.CreateFileAsync DownloadsFolder.CreateFileAsync DownloadsFolder.CreateFileAsync DownloadsFolder.CreateFileAsync DownloadsFolder.CreateFileAsync Method

Definition

Overloads

CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String)

Creates a new file inside the Downloads folder.

CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption)

Creates a new file in the Downloads folder, and specifies what to do if a file with the same name already exists in the Downloads folder.

CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String) CreateFileAsync(String)

Creates a new file inside the Downloads folder.

public : static IAsyncOperation<StorageFile> CreateFileAsync(Platform::String desiredName)
static IAsyncOperation<StorageFile> CreateFileAsync(winrt::hstring desiredName) const;
public static IAsyncOperation<StorageFile> CreateFileAsync(String desiredName)
Public Shared Function CreateFileAsync(desiredName As String) As IAsyncOperation(Of StorageFile)
Windows.Storage.DownloadsFolder.createFileAsync(desiredName).done( /* Your success and error handlers */ );

Parameters

desiredName
String String String

The desired name of the file to create.

If a file with the specified name already exists, a similar but unique name will be used. For example, if desiredName is "MyFileName.jpg" and a file by that name already exists in the Downloads folder, the new file will be created with a name like "MyFileName (1).jpg" instead.

Returns

When this method completes, it returns the new file as a StorageFile object.

See also

CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption) CreateFileAsync(String, CreationCollisionOption)

Creates a new file in the Downloads folder, and specifies what to do if a file with the same name already exists in the Downloads folder.

public : static IAsyncOperation<StorageFile> CreateFileAsync(Platform::String desiredName, CreationCollisionOption option)
static IAsyncOperation<StorageFile> CreateFileAsync(winrt::hstring desiredName, CreationCollisionOption option) const;
public static IAsyncOperation<StorageFile> CreateFileAsync(String desiredName, CreationCollisionOption option)
Public Shared Function CreateFileAsync(desiredName As String, option As CreationCollisionOption) As IAsyncOperation(Of StorageFile)
Windows.Storage.DownloadsFolder.createFileAsync(desiredName, option).done( /* Your success and error handlers */ );

Parameters

desiredName
String String String

The desired name of the file to create.

If there is an existing file in the current folder that already has the specified desiredName, the specified CreationCollisionOption determines how Windows responds to the conflict.

option
CreationCollisionOption CreationCollisionOption CreationCollisionOption

The enum value that determines how Windows responds if the desiredName is the same as the name of an existing file in the current folder.

Because the app can only access files in the Downloads folder that it created, you can't specify OpenIfExists or ReplaceExisting for this parameter.

Returns

When this method completes, it returns the new file as a StorageFile object.

See also