Table of contents
Collapse the table of content
Expand the table of content

Files, folders, and libraries

Last Updated: 11/15/2016

[ Updated for UWP apps on Windows 10. For Windows 8.x articles, see the archive ]

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.

Enumerate and query files and foldersAccess 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 fileRead and write a file using a StorageFile object.
Get file propertiesGet properties—top-level, basic, and extended—for a file represented by a StorageFile object.
Open files and folders with a pickerAccess 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 pickerUse FileSavePicker to let users specify the name and location where they want your app to save a file.
Accessing HomeGroup contentAccess content stored in the user's HomeGroup folder, including pictures, music, and videos.
Determining availability of Microsoft OneDrive filesDetermine if a Microsoft OneDrive file is available using the StorageFile.IsAvailable property.
Files and folders in the Music, Pictures, and Videos librariesAdd 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 foldersTrack 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.
Access the SD cardYou 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 permissionsApps can access certain file system locations by default. Apps can also access additional locations through the file picker, or by declaring capabilities.

Folder enumeration sample

File access sample

File picker sample

© 2017 Microsoft