My program to copy some directory, with subdirectories and files from server to local computer. I need, each local user can to modify it (edit/delete/remove/rename). But now it can do owner only. How can I set necessary permissions for copied directory, and its child items? I try such code:
String account = Path.Combine(Environment.MachineName, "Users");
FileSystemRights rights = FileSystemRights.FullControl;
AccessControlType controlType = AccessControlType.Allow;
DirectorySecurity security = local_commonDir.GetAccessControl(AccessControlSections.Access);
FileSystemAccessRule rule = new FileSystemAccessRule(account, rights, controlType);
security.AddAccessRule(rule);
local_commonDir.SetAccessControl(security);
But I got Exception:
Some or links to properties can't be transformed.
If I add absent Access Controls, then errors aren't present. I think that receiving an error because "Users" already exist. How to me to change the existing rights?
I found solution: