Dela via


FileSavePicker.PickSaveFileAsync Method

Definition

Shows the file picker so that the user can save a file and set the file name, extension, and location of the file to be saved. (UWP app)

public:
 virtual IAsyncOperation<StorageFile ^> ^ PickSaveFileAsync() = PickSaveFileAsync;
IAsyncOperation<StorageFile> PickSaveFileAsync();
public IAsyncOperation<StorageFile> PickSaveFileAsync();
function pickSaveFileAsync()
Public Function PickSaveFileAsync () As IAsyncOperation(Of StorageFile)

Returns

When the call to this method completes successfully, it returns a storageFile object that was created to represent the saved file. The file name, extension, and location of this storageFile match those specified by the user, but the file has no content.

To save the content of the file, your app must write the content to this storageFile.

Remarks

Warning

You must use the FileTypeChoices property to set one or more valid file extensions before calling this method, or it will thrown an exception.

Warning

If you try to show the file picker while your app is snapped the file picker will not be shown and an exception will be thrown. You can avoid this by making sure your app is not snapped or by unsnapping it before you call the file picker. The code examples in FileSavePicker and the File picker sample show you how.

Applies to

See also