Reputation:
FileStream fs = new FileStream("C:\\Users\\admin\\Documents\\test1.rtf", FileMode.Open, FileAccess.Write);
StreamWriter sw = new StreamWriter(fs);
sw.WriteLine("Hello World");
sw.Dispose();
fs.Dispose();
This code is giving an unauthorized access error even though I declared the <rescap:Capability Name="broadFileSystemAccess"/>
in the manifest and allowed the app those permissions in privacy setting in Windows 10.
Any help is appreciated.
Upvotes: 0
Views: 195
Reputation: 8611
The problem is that you don't have used the Windows Storage namespace APIs. If you read the document File access permissions, you would know this point.
This capability(
broadFileSystemAccess
) works for APIs in the Windows.Storage namespace.
Upvotes: 1