DownloadsFolder.CreateFileAsync Method
Definition
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.
Overloads
CreateFileAsync(String) |
Creates a new file inside the Downloads folder. |
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)
Creates a new file inside the Downloads folder.
public:
static IAsyncOperation<StorageFile ^> ^ CreateFileAsync(Platform::String ^ desiredName);
/// [Windows.Foundation.Metadata.Overload("CreateFileAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<StorageFile> CreateFileAsync(winrt::hstring const& desiredName);
[Windows.Foundation.Metadata.Overload("CreateFileAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<StorageFile> CreateFileAsync(string desiredName);
function createFileAsync(desiredName)
Public Shared Function CreateFileAsync (desiredName As String) As IAsyncOperation(Of StorageFile)
Parameters
- desiredName
-
String
Platform::String
winrt::hstring
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.
- Attributes
See also
Applies to
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);
/// [Windows.Foundation.Metadata.Overload("CreateFileWithCollisionOptionAsync")]
/// [Windows.Foundation.Metadata.RemoteAsync]
static IAsyncOperation<StorageFile> CreateFileAsync(winrt::hstring const& desiredName, CreationCollisionOption const& option);
[Windows.Foundation.Metadata.Overload("CreateFileWithCollisionOptionAsync")]
[Windows.Foundation.Metadata.RemoteAsync]
public static IAsyncOperation<StorageFile> CreateFileAsync(string desiredName, CreationCollisionOption option);
function createFileAsync(desiredName, option)
Public Shared Function CreateFileAsync (desiredName As String, option As CreationCollisionOption) As IAsyncOperation(Of StorageFile)
Parameters
- desiredName
-
String
Platform::String
winrt::hstring
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
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.
- Attributes