Share via


DownloadsFolder.CreateFileAsync Méthode

Définition

Surcharges

CreateFileAsync(String)

Crée un fichier dans le dossier Téléchargements.

CreateFileAsync(String, CreationCollisionOption)

Crée un fichier dans le dossier Téléchargements et spécifie ce qu’il faut faire si un fichier portant le même nom existe déjà dans le dossier Téléchargements.

CreateFileAsync(String)

Crée un fichier dans le dossier Téléchargements.

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)

Paramètres

desiredName
String

Platform::String

winrt::hstring

Nom souhaité du fichier à créer.

Si un fichier portant le nom spécifié existe déjà, un nom similaire mais unique est utilisé. Par exemple, si desiredName est « MyFileName.jpg » et qu’un fichier portant ce nom existe déjà dans le dossier Téléchargements, le nouveau fichier est créé avec un nom comme « MyFileName (1).jpg » à la place.

Retours

Une fois cette méthode terminée, elle retourne le nouveau fichier en tant qu’objet StorageFile .

Attributs

Voir aussi

S’applique à

CreateFileAsync(String, CreationCollisionOption)

Crée un fichier dans le dossier Téléchargements et spécifie ce qu’il faut faire si un fichier portant le même nom existe déjà dans le dossier Téléchargements.

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)

Paramètres

desiredName
String

Platform::String

winrt::hstring

Nom souhaité du fichier à créer.

S’il existe un fichier dans le dossier actif qui a déjà le desiredName spécifié, l’option CreationCollisionOption spécifiée détermine la façon dont Windows répond au conflit.

option
CreationCollisionOption

Valeur d’énumération qui détermine la façon dont Windows répond si desiredName est identique au nom d’un fichier existant dans le dossier actif.

Étant donné que l’application ne peut accéder qu’aux fichiers du dossier Téléchargements qu’elle a créé, vous ne pouvez pas spécifier OpenIfExists ou ReplaceExisting pour ce paramètre.

Retours

Une fois cette méthode terminée, elle retourne le nouveau fichier en tant qu’objet StorageFile .

Attributs

Voir aussi

S’applique à