I have created an application using Windows Universal Platform Tools in Visual Studio. In this application I have to rename files selected by user, but I am getting Permission denied exception while debugging.
After packing it & installing on machine I am not getting option to run it as administrator.
I have searched as much as I could but there doesn't seem to be any solution available on internet or I missed any query that could possibly solve this issue.
I can't see any type of permissions related to Storage as well in manifest file :(
Code: (Edit: This is now working Code)
FolderPicker folderPicker = new FolderPicker();
folderPicker.SuggestedStartLocation = PickerLocationId.Desktop;
folderPicker.FileTypeFilter.Add("*");
folderPicker.ViewMode = PickerViewMode.List;
StorageFolder folderPicked = await folderPicker.PickSingleFolderAsync();
if (folderPicked != null)
{
t_output.Text = folderPicked.Path.ToString();
StringBuilder outputText = new StringBuilder();
IReadOnlyList<StorageFile> fileList =
await folderPicked.GetFilesAsync();
int i=0;
foreach (StorageFile file in fileList)
{
outputText.Append(file.Name + "\n");
StorageFile fs = await folderPicked.GetFileAsync(file.Name);
await fs.RenameAsync("tanitani0" + i + ".jpg");
i++;
}
I am using t_output.Text TextBox to verify each & everything is going as I expect, if I don't use File.Copy then every file is being listed from the selected folder just like I want. But getting Permission Denied issue with File.Copy :( if I directly Use File.Move I am getting File Not Found Exception then.
What can be the way to solve this type of problem?