I am trying to create a folder on my local computer from plugin' my code is :
string currentFIlePath = "C://myGeneralFile";
bool isFileInDir = Directory.Exists(currentFIlePath);
if (!isFileInDir)
{
System.IO.Directory.CreateDirectory(currentFIlePath);
}
FileInfo fInfo = new FileInfo(currentFIlePath);
fInfo.IsReadOnly = false;
return currentFIlePath;
At the line : System.IO.Directory.CreateDirectory(currentFIlePath);
I get an error
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=' SOME NUMBER ' failed.
What can I do to solve this?
This might not work for a few reasons.
If your plugin is registered to run within the sandbox access to the server disk is prevented. If you are on-premise you can register your plugin outside of the sandbox which will allow you to write to the server disk.
If you are trying to write to your local machine disk (and not the server disk). This will never work, the plugin runs on the server and has no access to your local disk.