开发者

programatically removing "Include inheritable permissions from this object's parent" checkbox using C#

I have a requirement in my application to iterate through all the开发者_如何转开发 sub-folders programatically removing "Include inheritable permissions from this object's parent" check box using C#.

programatically removing "Include inheritable permissions from this object's parent" checkbox using C#

And also convert and add the inherited parent permissions as explicit permissions on the folder.

Can any one let me know ? how can i do it in C#.


You need to use ObjectSecurity.SetAccessRuleProtection:

string path = @"...";
FileSecurity fs = File.GetAccessControl(path);
fs.SetAccessRuleProtection(true, false);
File.SetAccessControl(path, fs);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜