1

I have some code to apply permissions to a folder that works but it sets the folder permissions as 'Special' with it being applied as "This Folder and Files" where I need it to be applied as "This folder, subfolders and files". What am I doing wrong?

dSecurity.AddAccessRule(new FileSystemAccessRule(@"DOMAIN\" + Account, FileSystemRights.ReadAndExecute, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, ControlType));
PigsIncorporated
  • 143
  • 4
  • 18

1 Answers1

2

Try splitting it across two rules;

dSecurity.AddAccessRule(new FileSystemAccessRule(@"DOMAIN\" + Account, FileSystemRights.ReadAndExecute, InheritanceFlags.ContainerInherit, PropagationFlags.InheritOnly, ControlType));
dSecurity.AddAccessRule(new FileSystemAccessRule(@"DOMAIN\" + Account, FileSystemRights.ReadAndExecute, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, ControlType));
Paul Talbot
  • 1,583
  • 1
  • 14
  • 28