Question Setting Folder Permissions For Groups

rodkort

New member
Joined
Jan 3, 2012
Messages
1
Location
Hull, East Yorkshire, England
Programming Experience
10+
Hi,

I have the following code which creates a directory and assigns certain permissions for users, which works fine:

VB.NET:
Dim FolderAcl As New DirectorySecurity

FolderAcl.AddAccessRule(New FileSystemAccessRule(userName, FileSystemRights.Modify, InheritanceFlags.None, PropagationFlags.None, AccessControlType.Allow))
FolderAcl.SetAccessRuleProtection(True, False) 'uncomment to remove existing permissions

System.IO.Directory.CreateDirectory(folderName, FolderAcl)

Like I said the works fine for a user in a domain (e.g. userName = "DOMAIN\john.smith"), however if I try to run it for a domain group (e.g. userName = "DOMAIN\Authenticated Users") then it doesn't work. How can I create a folder while setting permissions for a group?

Cheers

Simon
 
Top Bottom