I got Access is denied when trying to CreateFileAsync in InstalledLocation StorageFolder
StorageFolder storageFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
StorageFile file = await storageFolder.CreateFileAsync("fileNmae", Windows.Storage.CreationCollisionOption.ReplaceExisting);
Also I tried
var storageFolder = await StorageFolder.GetFolderFromPathAsync("ms-appx:///");
And got "value does not fall within the expected range"
I can go around and CreateFileAsync
in Windows.Storage.ApplicationData.Current.LocalFolder
then CopyAsync
to InstalledLocation StorageFolder?
StorageFolder storageFolder = Windows.Storage.ApplicationData.Current.LocalFolder;
StorageFile file = await storageFolder.CreateFileAsync("fileName", Windows.Storage.CreationCollisionOption.ReplaceExisting);
StorageFolder installedLocationFolder = Windows.ApplicationModel.Package.Current.InstalledLocation;
var result = await file.CopyAsync(installedLocationFolder, "fileName", Windows.Storage.NameCollisionOption.ReplaceExisting);
but CreateFileAsync
in InstalledLocation StorageFolder gives Access denied ?
is that because of security reason or I'm coding something wrong here?