In my Windows 8.1 application, I want to write to a Json file in my datamodel. (See Image 1). I have a button click event with the following code:
Uri dataUri = new Uri("ms-appx:///DataModel/SampleData.json");
StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(dataUri);
await Windows.Storage.FileIO.WriteTextAsync(file, "sampletext");
But after clicking the button, I get a UnauthorizedAccessException. (See Image 2). Is there a way to access the Json file for writing?


source
share