Reputation: 116
I need to create a new sub folder say 'MyNewFolder' under My Documents.
I also need to grant permission my application or even everyone to read/write in 'MyNewFolder' folder.
I'm on OOB & elevated trust
How do I create a new folder & at the same time give permission to everyone to read/write on the new folder ?
Upvotes: 2
Views: 559
Reputation: 189477
You can create a sub folder in My Documents with this code:-
DirectoryInfo di = new DirectoryInfo(Environment.GetFolderPath(SpecialFolder.MyDocuments));
myDocs.CreateSubDirectory("MyNewFolder");
However you are not able to manipulate the folder's ACL hence you cannot make it available to everyone.
If you need to create a file which is available to everyone you will need to invoke the SaveFileDialog box and have the user specify a file location which has the appropriate security.
Upvotes: 1