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
Copy file name to clipboardExpand all lines: hub/apps/develop/files/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ If you're developing packaged WinUI apps, the WinRT storage APIs can be a powerf
41
41
|[Create, write, and read a file](/windows/uwp/files/quickstart-reading-and-writing-files)| Read and write a file using a [StorageFile](/uwp/api/Windows.Storage.StorageFile) object. |
42
42
|[Best practices for writing to files](/windows/uwp/files/best-practices-for-writing-to-files)| Learn best practices for using various file writing methods of the [FileIO](/uwp/api/windows.storage.fileio) and [PathIO](/uwp/api/windows.storage.pathio) classes. |
43
43
|[Get file properties](/windows/uwp/files/quickstart-getting-file-properties)| Get properties—top-level, basic, and extended—for a file represented by a [StorageFile](/uwp/api/Windows.Storage.StorageFile) object. |
44
-
|[Open files and folders with a picker](/windows/uwp/files/quickstart-using-file-and-folder-pickers)| Access files and folders by letting the user interact with a picker. You can use the [FolderPicker](/uwp/api/Windows.Storage.Pickers.FolderPicker) to gain access to a folder. |
44
+
|[Open files and folders with a picker](/windows/uwp/files/quickstart-using-file-and-folder-pickers)| Access files and folders by letting the user interact with a picker. You can use the [FolderPicker](/uwp/api/Windows.Storage.Pickers.FolderPicker) to gain access to a folder.<br/><br/>**NOTE:** 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).|
45
45
|[Save a file with a picker](/windows/uwp/files/quickstart-save-a-file-with-a-picker)| 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. |
46
46
|[Accessing HomeGroup content](/windows/uwp/files/quickstart-accessing-homegroup-content)| Access content stored in the user's HomeGroup folder, including pictures, music, and videos. |
47
47
|[Determining availability of Microsoft OneDrive files](/windows/uwp/files/quickstart-determining-availability-of-microsoft-onedrive-files)| Determine if a Microsoft OneDrive file is available using the [StorageFile.IsAvailable](/uwp/api/windows.storage.storagefile.isavailable) property. |
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