I'm pretty new to SharePoint. My work stores a lot of files/folders in SharePoint. I need to change folder permission on multiple sub folders (maybe 3000 sub folders). We do have a folder structure, for example:

Big Folder 1

Main Folder 1> Sub Folder 1, Sub Folder 2, Sub folder 3
Main Folder 2> Sub Folder 1, Sub Folder 2, Sub Folder 3

Big Folder 2
Main Folder 1> Sub Folder 1, Sub Folder 2, Sub folder 3
Main Folder 2> Sub Folder 1, Sub Folder 2, Sub Folder 3

So there are about 50 Big folders and within which there are many Main Folders within which there are 3 sub folders within which there are many files. These sub folders have same name across all the folders. I need everyone to be able to access the Site (which everyone has permission to at the moment) but I just want Sub Folder 3 to be restricted to say 5 specific people.

How do I go about doing this? I could do unique permissions but then I would have to go into all the sub folders>Manage Permission>Add these five people? And like I said there are over 3000 sub folders.

There must be an easier way to do this. Is there a script I can run that will say look for any folders named "X" and set permissions for "X". Or anyway I can achieve this?

Also, we have a SharePoint person in the company but he isn't very knowledgeable and he hosts the site. If there was a script I could run, would I have to run the script on the server/computer where the SP is being hosted? I have admin access to the SharePoint site.

Greatly appreciated.

2 Answers 2


So you could write some CSOM code in C# to set permissions on your folder structure. This code can be run remotely.

An example of helpful code though not a solution is here: https://samlman.wordpress.com/2015/02/28/using-the-sharepoint-2010-client-object-model-part-5/

Other approaches running Powershell for example against the SharePoint object model will require the code to be run from a server in the farm.

// get a reference to the folder (this assumes path points to a valid folder)

SPFolder folder = SharePointConfiguration.Site.GetFolder(path);

// get a reference to the Sharepoint group collection

SPGroupCollection spc = SharePointConfiguration.Site.SiteGroups;

// get a reference to the group who’s permissions you want to modify for the folder above

SPGroup group = spc[groupName];

// create a role assignment from the group reference

SPRoleAssignment roleAssignment = new SPRoleAssignment((SPPrincipal)group);

// break role inheritance for folders/files because they will be having permissions separate from their parent file/folder


// update the role assignments for the group by adding the permissionSet “TestPermissionLevel” which is a custom

// permissionset I created manually…you can easily use any of the built-in permission sets

roleAssignment.RoleDefinitionBindings.Add(SharePointConfiguration.Site.RoleDefinitions["Test Permission Level"]);

// apply the new roleassignment to the folder.  You can do this at the listitem level if desired (i.e. this could be SPfile.Item…. instead of SPFolder.Item)


Check some resources:

Programmatically set permissions to a folder in a SharePoint list

How To make SharePoint document library folder unique Permission Programmatically

  • Hi can I do something like - search folders which equals name "SNP", for each folder named SNP do, permission levvel = groupIwillCreate. May 26, 2015 at 3:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.