I want my code to rename files on my Desktop, but I do not have permission to edit files on my Desktop. How do I get the necessary permission?
My code:
public async Task RenameFile(fileLocation, newName)
{
try
{
StorageFile bkpFile = await StorageFile.GetFileFromPathAsync(fileLocation);
await bkpFile.RenameAsync(newName);
}
catch { /* Eat error */ }
}
Permissions set in my Package.Appxmanifest file:
<Capabilities>
<Capability Name="picturesLibrary" />
<Capability Name="documentsLibrary" />
<Capability Name="internetClient" />
<Capability Name="removableStorage" />
<Capability Name="enterpriseAuthentication" />
<Capability Name="videosLibrary" />
<Capability Name="privateNetworkClientServer" />
<DeviceCapability Name="location" />
<DeviceCapability Name="webcam" />
<DeviceCapability Name="microphone" />
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="name:serialPort" />
</m2:Device>
</m2:DeviceCapability>
</Capabilities>
EDIT: I also need permission to rename files in attached devices, such as SD cards and thumb drives.