Düzenle

Aracılığıyla paylaş


Files, folders, and libraries

You use the APIs in the Windows.Storage, Windows.Storage.Streams, and Windows.Storage.Pickers namespaces to read and write text and other data formats in files, and to manage files and folders. In this section, you'll also learn about reading and writing app settings, about file and folder pickers, and about special sand-boxed locations such as the Video/Music library.

Topic Description
Enumerate and query files and folders Access files and folders in either a folder, library, device, or network location. You can also query the files and folders in a location by constructing file and folder queries.
Create, write, and read a file Read and write a file using a StorageFile object.
Best practices for writing to files Learn best practices for using various file writing methods of the FileIO and PathIO classes.
Get file properties Get properties—top-level, basic, and extended—for a file represented by a StorageFile object.
Open files and folders with a picker Access files and folders by letting the user interact with a picker. You can use the FolderPicker to gain access to a folder.
Save a file with a picker Use FileSavePicker to let users specify the name and location where they want your app to save a file.
Accessing HomeGroup content Access content stored in the user's HomeGroup folder, including pictures, music, and videos.
Determining availability of Microsoft OneDrive files Determine if a Microsoft OneDrive file is available using the StorageFile.IsAvailable property.
Files and folders in the Music, Pictures, and Videos libraries Add existing folders of music, pictures, or videos to the corresponding libraries. You can also remove folders from libraries, get the list of folders in a library, and discover stored photos, music, and videos.
Track recently used files and folders Track files that your user accesses frequently by adding them to your app's most recently used list (MRU). The platform manages the MRU for you by sorting items based on when they were last accessed, and by removing the oldest item when the list's 25-item limit is reached. All apps have their own MRU.
Track file system changes in the background Track changes to the file system, even when the app isn't running.
Access the SD card You can store and access non-essential data on an optional microSD card, especially on low-cost mobile devices that have limited internal storage.
File access permissions Apps can access certain file system locations by default. Apps can also access additional locations through the file picker, or by declaring capabilities.
Fast access to file properties in UWP Efficiently gather a list of files and their properties from a library to use in a UWP app.

Folder enumeration sample

File access sample

File picker sample