Introduction
Windows Phone 8 introduced the ApplicationData class to easily work with IsolatedStorage and async/awaitkeywords.
In Windows Phone currently it is possible to use only LocalFolder because RoamingStorage and TemporaryStorage throw the NotSupportedException.
However, all the operations can be done with a few lines.
How to use folders
How to use folders
Create folder
- StorageFolder folder = await ApplicationData.Current.LocalFolder.CreateFolderAsync("myFolder", CreationCollisionOption.ReplaceExisting);
- var folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("myFolder");
- StorageFolder folder;
- try
- {
- folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("myFolder");
- MessageBox.Show(folder.Name);
- }
- catch (FileNotFoundException ex)
- {
- MessageBox.Show("Folder not found");
- }
- var folders = await ApplicationData.Current.LocalFolder.GetFoldersAsync();
- foreach (var folder in folders)
- MessageBox.Show(folder.Name);
- var folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("myFolder");
- await folder.RenameAsync("myRenamedFolder");
- var folder = await ApplicationData.Current.LocalFolder.GetFolderAsync("myFolder");
- await folder.DeleteAsync(StorageDeleteOption.PermanentDelete);
Create file
- var file = await ApplicationData.Current.LocalFolder.CreateFileAsync("myFile.txt", CreationCollisionOption.ReplaceExisting);

Join the conversation! Your thoughts help the community grow.