IFileDialogService.SelectSaveAsFileAsync 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.
Selects a file using the common file dialog to use to save.
public System.Threading.Tasks.ValueTask<string> SelectSaveAsFileAsync (string title, string initialDirectory, string initialFileName, Microsoft.VisualStudio.RpcContracts.FileDialog.DialogFilters filters, System.Threading.CancellationToken cancellationToken);
abstract member SelectSaveAsFileAsync : string * string * string * Microsoft.VisualStudio.RpcContracts.FileDialog.DialogFilters * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<string>
Public Function SelectSaveAsFileAsync (title As String, initialDirectory As String, initialFileName As String, filters As DialogFilters, cancellationToken As CancellationToken) As ValueTask(Of String)
Parameters
- title
- String
The dialog title. Leave this empty to use the default behavior.
- initialDirectory
- String
The initial directory. This should be an absolute path. Leave this empty to use the default behavior.
- initialFileName
- String
The initial filename used in the text input box. File paths are not supported. This can be an empty string.
- filters
- DialogFilters
The filters for displayed files that include a default filter index to specify which filter should be used on open.
- cancellationToken
- CancellationToken
The cancellation token. Will throw if cancellation is requested before opening the dialog. The user must close the dialog for any requested cancellation to take affect when the dialog is open.
Returns
A string representing the new file name. If the user closes or cancels the dialog, then this returns an empty string.
Exceptions
If the dialog fails to open or fails to retrieve the selected filename, then this will throw.