How to access Isolated or Local Storage Data of Windows phone App (Silverlight/WinRT)

Initially you guys have been using Isolated Storage Explorer (ISETool.exe) to access the Isolated/Local Storage data of your Windows phone applications. But that requires typing long commands into the command prompt with app id. You need to remember different commands in order to access different files and is a hectic procedure.

But now we have got a new tool which can make this access easier and provides a GUI interface with upload and download features.

The tool is called IsoStoreSpy. It is an open source project hosted under the Codeplex community.

The download link for the tool is given below. You can download the version that suits your environment.

 

Download IsoStoreSpty tool

 

Step 1:

Now to start with first you need to open the tool

 


 

Step 2:

Click on the Settings icon in the middle or the top-left side of the tool. Now you need to select the device.

 


 

Step 3:

If you are running on the device then select Device or else Emulator. If you are running on an emulator then please install the app in the emulator and be sure the App is Not Running. So that this tool can access your app’s settings file or correspondingly in the phone just install the app and be sure the app is not running.

In this case we are assuming the app is running on the emulator.

 


 

Step 4:

Now by default it will show all the files in the local folder of the application. To view the files under roaming settings select Roaming under the Directory section.

You can also import or export a file into the application through this tool.

 


 

I hope this post will be helpful to you.

Accessing the Isolated Storage Data of developer apps installed to emulator or unlocked Windows Phone device

While developing apps sometimes you feel the need to check the isolated storage of your app to check if things are working as intended. For emulators and devices running windows phone 8 or lower, Windows Phone Power Tools was quite handy but they still don’t support windows phone 8.1 emulators and their website does not show any information about any planned releases. I came across Isolated Storage Explorer tool which can help you out. MSDN describes it as

Isolated Storage Explorer (ISETool.exe) is a command-line tool that is installed with the Windows Phone SDK. You can use Isolated Storage Explorer to list, copy, and replace files and directories in your app’s local folder. You can use these commands to verify that the correct files are being saved in the correct location, or to test your app with files that you provide.

 
If you want to try a simpler method you can refer to the following link given below
https://windowsapptutorials.com/windows-phone/isolated-storage/how-to-access-isolated-or-local-storage-data-of-windows-phone-app-silverlightwinrt/
 

ISETool can be used with any emulator or device which targets WP 8.1/8/7.1. It is installed in the following location

Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool


Here are some conditions which need to be true while working with ISE

  • The app that you want to test must be installed on the emulator or device
  • The emulator or device must be running, but the app doesn’t have to be running

 

Also note that you can’t do the following with ISE

 

  • You can’t view isolated storage for apps that you’ve installed from the Windows Phone Store.
  • You can’t view app settings that are stored in the local folder in Isolated Storage Explorer. These are settings that the app saved by using the IsolatedStorageSettings class.

 

Isolated Storage Explorer has the following syntax:

 

ISETool.exe <cmd[:param]> <target-device[:param]> <product-id> [<desktop-path>]

 

 

Now let us look at a few things that can be done using ISETool. Let us assume the product ID of the app we are developing is f8ce6878-0aeb-497f-bcf4-65be961d4bba. You can get the product ID of your app from WMAppManifest.xml file

 


 

Copying files from App’s isolated storage to computer

Follow the following steps to copy files from app’s isolated storage to computer

Step 1. Deploy the app

Deploy the app you want to test to the emulator or a device.

Step 2. Run the app

Run the app to create local files and directories.

Step 3. Get the app’s product ID

Get the Product GUID for the app specified in the ProductID attribute of the App element of the WMAppManifest.xml file.

Step 4. Navigate to ISETool.exe using command prompt

Open Command prompt in your computer and go to C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool
directory.

cd C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool

Step 5. Copy files from app’s isolated storage

To copy all of the files from the app’s local folder to your computer, type the following command using the Product GUID obtained in the previous steps and specify a target directory on your computer.

ISETool.exe ts <xd|de> <product-id> <desktop-path>

 

The example below shows how this can be done.

ISETool.exe ts xd f8ce6878-0aeb-497f-bcf4-65be961d4bba c:\data\myfiles

 

This tool creates an IsolatedStore folder under the directory you have specified and copies the content from app’s isolated storage to this location.

Replacing files in the local folder

You can use Isolated Storage Explorer to replace the files and directories in an app’s local folder on an emulator or a device with files and directories from your computer. Replacing files can be useful for testing an app. Follow the following steps.

Step 1. Deploy the app

Deploy the app you want to test to the emulator or a device.

Step 2. Run the app

Run the app to create local files and directories.

Step 3. Get the app’s product ID

Get the Product GUID for the app specified in the ProductID attribute of the App element of the WMAppManifest.xml file.

Step 4. Navigate to ISETool.exe using command prompt

Open Command prompt in your computer and go to C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool
directory.

cd C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool

Step 5. Replace files from app’s isolated storage

To replace all the files in the app’s local folder with files from your computer, type the following command using the Product GUID obtained in the previous steps and specify the source directory on your computer.

ISETool.exe rs <xd|de> <product-id> <desktop-path>

 

The following example shows how this can be done.

ISETool.exe rs xd f8ce6878-0aeb-497f-bcf4-65be961d4bba “C:\Data\My Files”

Listing files in the local folder

You can use Isolated Storage Explorer to list the files and directories in the local folder for an app.

Step 1. Deploy the app

Deploy the app you want to test to the emulator or a device.

Step 2. Run the app

Run the app to create local files and directories.

Step 3. Get the app’s product ID

Get the Product GUID for the app specified in the ProductID attribute of the App element of the WMAppManifest.xml file.

Step 4. Navigate to ISETool.exe using command prompt

Open Command prompt in your computer and go to C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool
directory.

cd C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Tools\IsolatedStorageExplorerTool

Step 5. List the files

To list the files and directories at the root of the app’s local folder, type the following command using the Product GUID obtained in the previous steps.

ISETool.exe dir <xd|de> <product-id>

 

The following example shows a command that lists the files and directories at the root of the app’s local folder on the emulator.

ISETool.exe dir xd f8ce6878-0aeb-497f-bcf4-65be961d4bba

 

Uploading files from folder on computer to app’s local folder

The following command uploads all of the files from the C:\data\myfiles folder on the computer to the app’s local folder on the attached device.

ISETool.exe rs de f8ce6878-0aeb-497f-bcf4-65be961d4bba c:\data\myfiles

Getting a list of valid device targets

The following command lists the valid device targets and the device index for each device.

ISETool.exe EnumerateDevices

Listing the contents of a folder on connected device

Lists the contents of the \My Folder\Images subfolder in the app’s isolated store on the device at index 2.

ISETool.exe dir:”My Folder\Images” deviceindex:2 f8ce6878-0aeb-497f-bcf4-65be961d4bba

Note: You can use the enumerate devices command to get a list of all valid devices and their ids.

 


Isolated Storage in Windows phone app – Reading and saving images

This is the fourth post regarding Isolated Storage in Windows Phone app. In this post I am going to talk about How to read and save captured images in isolated storage.

Note: To understand this post better you should test the following code on a real phone not an emulator as camera of emulator will give you a black screen.

 

1. Before starting with this post you should have a better understanding of Photochoosertask and CameraCaptureTask.

 

If you don’t have any idea about these tasks you can refer to the following post.

http://www.windowsapptutorials.com/launchers-and-choosers/launchers-and-choosers-how-to-choose-photo-from-media-library-or-capture-a-new-one-in-windows-phone-app/

 

2. In the following post first I will explain you how to save and read the image chosen from medial library into isolated storage. Then I will explain you how to save the image captured from camera into the isolated storage and how you can read that image from isolated storage.

 

Both the tasks have similar code for saving and reading the image except the code for launching the tasks.

 

3. First create a blank project Saveimages.

 


 

4. Add the following namespaces to the page MainPage.xaml.cs.

 

 
5. Now first we will launch the photochoosertask and will select a image from media library and will save it to isolated storage.

 

Save the existing image

First create a button to save the existing image and add the following code to click event handler of the button.

 

 
The Task completed event handler of the choosertask will save the image to the isolated storage having the file name existing.jpg. The code is given below.

 

 

Now you can read the image from isolated storage and display it in the imagecontrol given on the MainPage by clicking on the read selected image button. The following code is given below.

 

 

Save the captured image

The procedure for the CameraCapturetask is same as that of photochooser. We will create a button to launch the CameraCapturetask and will save the captured image in isolated storage having the name captured.jpg.

 

 

 

 

We can read the captured image in the same way as we did for the Photochooser task. The code for the read captured image button is as shown below.

 

 

Note: You will observe that the code for both the tasks will be similar as there is no difference between the read save image code of both the tasks except the filename.

 

 

 

6. I hope this post will be helpful to you. You can download the full project source file from the link given below.

 
Download Full Project file Saveimages.zip
 
 
Isolated Storage in Windows Phone app – Introduction
Isolated Storage in Windows phone app – Store data in IsolatedStorageSettings
Isolated Storage in Windows phone app – Reading and saving text files

Isolated Storage in Windows phone app – Reading and saving text files

This is the third post regarding Isolated Storage in Windows Phone app. In this post I am going to talk about How to store data in Text files in isolated storage in your app and perform different manipulation operations on it like reading , writing ,append , update and deletion of textfiles.

 

1. Create a new project Textfiles.

2. Now we will create a text file in isolated storage having the name Samplefile.txt.

3. But before starting with it you need to add the following namespace to your page in which you are using isolated storage code.

 

 

Basically we use IsolatedStorageFileStream class to read, write and create file in isolated storage. Since this class extends FileStream, you can use an instance of IsolatedStorageFileStream in most situations where a FileStream might otherwise be used, such as to construct a StreamReader or StreamWriter.

 

4. Add the following line of code which denotes the filename globally to the MainPage.xaml.cs.

 

 

Creating a Text file

In the following code given below we first create a text file and write some data to it.

 

 

Reading from a text file

In this segment of code we first open the text file and read the content from it and display it in the Textblock named Displayblock given below in the MainPage.

 

 

Write to the existing file

In the following lines of code we open the existing file and overwrite its content with new data.

 

 

Append to the existing file

This code is similar to the code given above for writing to the file. But there is only one difference that the file mode here chosen is Append not open.It writes the new data to the end of text file.

 

 
Delete the text file

Before deleting the file we check whether it is present in isolated storage or not .If it is present we delete it.

 

 

Note: The file which we have created above has been directly saved to the isolated storage.

 


 

5. When you are dealing with big projects and have large no of text files it is necessary that you should save them properly.A good practice is to create different folders/Directories and save the file in it.

 

Create a new directory

 

 
The code for different operations explained above on normal files will be same for the directory files. The only change will be in the name of file as shown above.

 

6. I hope this post will be helpful to you. You can download the full source project file from the link given below.

 
Download Full Project Textfiles.zip
 
 
Isolated Storage in Windows Phone app – Introduction
Isolated Storage in Windows phone app – Store data in IsolatedStorageSettings
Isolated Storage in Windows phone app – Reading and saving images

Isolated Storage in Windows phone app – Store data in IsolatedStorageSettings

This is the second post regarding Isolated Storage in Windows Phone app. In this post I am going to talk about How to store data in IsolatedStorgeSettings and perform different manipulation operations on it like reading ,writing and update.

Basically the easiest way to put data into Windows Phone IsolatedStorage is to use the IsolatedStorageSettings class which  is a Dictionary<TKey, TValue> that stores key-value pairs in isolated storage.  A typical use is to save settings, such as the number of times the user has opened the application, the no of items to be displayed in a listbox etc.

In the following post I will give you a example of storing the students name and marks in isolated storage with the help of single objects and composite objects.

The different steps that need to be followed are

1. First create a new project having the name Isolatedstoragesettings.

2. Then open the MainPage.xaml and remove the XAML code for the StackPannel named TitlePanel and replace it with the following code so as to change the page name and application name .


 

 

3. Now add the following Xaml code in the Grid named ContentPanel so as to create Four buttons to save and read the data from IsolatedStorageSettings in case of single and composite object.

 

 


4. Now open the page MainPage.xaml.cs.

5. Add the following namespace in the page given below.

6. Add the following code for the Save and Read single object data Button click event handler below the constructor of the page. The code describes how to save the value of name and marks in IsolatedStorageSettings and How to retrieve the data from IsolatedStorageSettings.

 



7. Now for composite object you need to create a sample class called Resultclass with the two properties name and marks.

8. Add the following code for the Save and Read composite object data Button click event handler below the constructor of the page. The code describes how to save the value of name and marks in IsolatedStorageSettings and How to retrieve the data from IsolatedStorageSettings.

 



9. Now run the application on emulator. You will see the following output.


10. Now click on the save button of single object data first to save the values to isolated storage and then on read button to read the values from IsolatedStorgeSettings. The Output is shown below.


Note: The next time you will click on save button it will throw an error because the value of key that is saved in isolated settings must be unique and you are violating it by saving the same key again. To avoid it use try catch or enclose the code in if clause given below.

 

11. Similarly click on click on the save button of composite object data first to save the values to isolated storage and then on read button to read the values from IsolatedStorgeSettings. The Output is shown below.

 

 

Note: If you are working on Universal app Project the following code will give you a syntax error. So as to correct it replace the following line of code.

 

Replace it with


12. I hope this post will be helpful to you. Download the full Project zip file from the link given below.

Download Full project file Isolatedstoragesettings.zip
Stay tuned with rest of posts given below.

Isolated Storage in Windows Phone app – Introduction
Isolated Storage in Windows phone app – Reading and saving text files
Isolated Storage in Windows phone app – Reading and saving images

Isolated Storage in Windows Phone app – Introduction

What is Isolated Storage?

Isolated Storage is a space in Windows phone where you can store the local data of your application. For example if you are making a note application you can store the note made by user in your app in form of text file in Isolated Storage. You can also save images, music files etc in Isolated Storage.

Why to use it?

The next question which comes into your mind is why to use Isolated Storage.

The answer to this question is very simple consider the example of note application given above. Suppose the user makes a note from your application but as the user closes the application the content of note made by user is lost which is similar to RAM in CPU which losses its content when Computer is Shut down. So as to save the note made by user in your application we use Isolated Storage which is similar to ROM in CPU whose content remain unchanged when CPU Shut down.

Different Methods

There are different ways of storing data in Windows phone app

1. IsolatedStorageSettings

2. Folders and files in Isolated Storage

3. Database

Operations

You can perform different manipulation in the Isolated Storage like writing to a file, creating folders and files, reading data, removing file, etc.

Key points

1. All Input/Output operations are restricted to isolated storage and do not have direct access to the underlying operating system file system, which helps to provide security and prevents unauthorized access and data corruption from other apps.

2. If you have two applications that work with the same data, then that data can’t be local to either application. You need to use a web service.

3. Windows Phone applications do not have an imposed quota size because the requirements for each application’s scenario are different. The quota size is unlimited.

I hope this introductory post will be helpful to you. Stay tuned with the rest of posts given below.

 

Isolated Storage in Windows phone app – Store data in IsolatedStorageSettings
Isolated Storage in Windows phone app – Reading and saving text files
Isolated Storage in Windows phone app – Reading and saving images