Share via


IFilePicker.PickAsync(PickOptions) Method

Definition

Opens the default file picker to allow the user to pick a single file.

public System.Threading.Tasks.Task<Microsoft.Maui.Storage.FileResult?> PickAsync (Microsoft.Maui.Storage.PickOptions? options = default);
abstract member PickAsync : Microsoft.Maui.Storage.PickOptions -> System.Threading.Tasks.Task<Microsoft.Maui.Storage.FileResult>
Public Function PickAsync (Optional options As PickOptions = Nothing) As Task(Of FileResult)

Parameters

options
PickOptions

File picker options to use; may be null for default options.

Returns

File picking result object, or null if picking was cancelled by the user.

Remarks

File types can be specified in order to limit files that can be selected, using a PickOptions object. Note that this method may re-throw platform specific exceptions that occurred during file picking. When calling PickAsync(PickOptions) again while showing a file picker, the Task object that was returned from the first call is cancelled. Be sure to also handle the TaskCanceledException in this case.

Applies to