VB 2005 .net 2.0
I have a folder which has about 5 inherited permissions. I want to remove or change one of these permissions. In vb 6, I was able to do this through API but would like to do this in .net.
It seems I can only do this if I break inheritance on all permissions. Here's my code.
Dim dInfo As New DirectoryInfo(FileName)
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()
dSecurity.RemoveAccessRuleSpecific(New FileSystemAccessRule(Account, Rights, IFlags, _
PropagationFlags.InheritOnly, AccessControlType.Allow))
dInfo.SetAccessControl(dSecurity)
I tried including
dSecurity.SetAccessRuleProtection(True, True)
before the SetAccessControl but this breaks inheritance on all the permission not just this specific one.
So how can I remove one inherited user group called Domain User with Full permission on Files only and leave the other permissions still inherited?
Thanks