私は Windows 8 xaml C# アプリで作業しています。曲の xml を読み込んで新しいノードを追加しようとしています。コードは次のとおりです。
StorageFolder sf;
sf = KnownFolders.MusicLibrary;
StorageFile file = await sf.GetFileAsync(strSongName);
var item = await file.OpenAsync(FileAccessMode.Read);
IRandomAccessStream raStream;
IOutputStream outputStream;
DataWriter writer;
var lc = ApplicationData.Current.LocalFolder;
var infolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFolder folder = await StorageFolder.GetFolderFromPathAsync(infolder.Path);
StorageFile file1 = await folder.GetFileAsync("songxml.xml");
var filetest = await file1.OpenAsync(FileAccessMode.Read);
Stream inStream = filetest.AsStreamForRead();
XDocument xdoc = XDocument.Load(inStream);
string content = xdoc.ToString();
raStream = await file1.OpenAsync(FileAccessMode.ReadWriteUnsafe);
outputStream = raStream.GetOutputStreamAt(0);
writer = new DataWriter(outputStream);
StringBuilder outputText = new StringBuilder();
outputText.Append(content.ToString());
このコードの実行中に System.Unauthorizedaccessexception が発生します