You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use [**FileSavePicker**](/uwp/api/Windows.Storage.Pickers.FileSavePicker) to let users specify the name and location where they want your app to save a file.
18
18
19
19
> [!NOTE]
20
20
> For a complete sample, see the [File picker sample](https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/FilePicker).
21
21
22
-
22
+
> [!NOTE]
23
+
> In a desktop app (which includes WinUI 3 apps), you can use file and folder pickers from [Windows.Storage.Pickers](/uwp/api/windows.storage.pickers). However, if the desktop app requires elevation to run, you'll need a different approach because these APIs aren't designed to be used in an elevated app. For an example, see [FileSavePicker](/uwp/api/windows.storage.pickers.filesavepicker#in-a-desktop-app-that-requires-elevation).
23
24
24
25
## Prerequisites
25
26
26
-
27
-
-**Understand async programming for Universal Windows Platform (UWP) apps**
27
+
-**Understand async programming for Universal Windows Platform (UWP) apps**
28
28
29
29
You can learn how to write asynchronous apps in C# or Visual Basic, see [Call asynchronous APIs in C# or Visual Basic](../threading-async/call-asynchronous-apis-in-csharp-or-visual-basic.md). To learn how to write asynchronous apps in C++, see [Asynchronous programming in C++](../threading-async/asynchronous-programming-in-cpp-universal-windows-platform-apps.md).
30
30
31
-
-**Access permissions to the location**
31
+
-**Access permissions to the location**
32
32
33
33
See [File access permissions](file-access-permissions.md).
34
34
35
35
## FileSavePicker: step-by-step
36
36
37
37
Use a [**FileSavePicker**](/uwp/api/Windows.Storage.Pickers.FileSavePicker) so that your users can specify the name, type, and location of a file to save. Create, customize, and show a file picker object, and then save data via the returned [**StorageFile**](/uwp/api/Windows.Storage.StorageFile) object that represents the file picked.
@@ -48,21 +48,21 @@ Use a [**FileSavePicker**](/uwp/api/Windows.Storage.Pickers.FileSavePicker) so t
48
48
savePicker.SuggestedFileName="New Document";
49
49
```
50
50
51
-
Setpropertiesonthefilepickerobjectthatarerelevanttoyourusersandyourapp. Thisexamplesetsthreeproperties: [**SuggestedStartLocation**](/uwp/api/windows.storage.pickers.filesavepicker.suggestedstartlocation), [**FileTypeChoices**](/uwp/api/windows.storage.pickers.filesavepicker.filetypechoices) and [**SuggestedFileName**](/uwp/api/windows.storage.pickers.filesavepicker.suggestedfilename).
52
-
53
-
-Becauseouruserissavingadocumentortextfile, thesamplesets [**SuggestedStartLocation**](/uwp/api/windows.storage.pickers.filesavepicker.suggestedstartlocation) totheapp's local folder by using [**LocalFolder**](/uwp/api/windows.storage.applicationdata.localfolder). Set [**SuggestedStartLocation**](/uwp/api/windows.storage.pickers.fileopenpicker.suggestedstartlocation) to a location appropriate for the type of file being saved, for example Music, Pictures, Videos, or Documents. From the start location, the user can navigate to other locations.
51
+
Setpropertiesonthefilepickerobjectthatarerelevanttoyourusersandyourapp. Thisexamplesetsthreeproperties: [**SuggestedStartLocation**](/uwp/api/windows.storage.pickers.filesavepicker.suggestedstartlocation), [**FileTypeChoices**](/uwp/api/windows.storage.pickers.filesavepicker.filetypechoices) and [**SuggestedFileName**](/uwp/api/windows.storage.pickers.filesavepicker.suggestedfilename).
52
+
53
+
-Becauseouruserissavingadocumentortextfile, thesamplesets [**SuggestedStartLocation**](/uwp/api/windows.storage.pickers.filesavepicker.suggestedstartlocation) totheapp's local folder by using [**LocalFolder**](/uwp/api/windows.storage.applicationdata.localfolder). Set [**SuggestedStartLocation**](/uwp/api/windows.storage.pickers.fileopenpicker.suggestedstartlocation) to a location appropriate for the type of file being saved, for example Music, Pictures, Videos, or Documents. From the start location, the user can navigate to other locations.
@@ -99,3 +99,13 @@ The example checks that the file is valid and writes its own file name into it.
99
99
100
100
> [!TIP]
101
101
>Youshouldalwayscheckthesavedfiletomakesureitisvalidbeforeyouperformanyotherprocessing. Then, youcansavecontenttothefileasappropriatefor your app, and provide appropriate behavior if the picked file is not valid.
0 commit comments