SPPrincipal principal = userToAdd;
SPFolderCollection submissions = web.GetFolder("Submissions").SubFolders;
SPFolder newFolder = submissions.Add("testfolder");
SPListItem folderItem = newFolder.Item;
folderItem.BreakRoleInheritance(true);
folderItem.Update();
SPRoleAssignment folderRoleAssignment = new SPRoleAssignment(principal); SPRoleAssignmentCollection folderRoleAssignments = folderItem.RoleAssignments; SPRoleDefinitionBindingCollection folderRoleDefBindings = folderRoleAssignment.RoleDefinitionBindings;
folderRoleDefBindings.Add(roleDefinitions["Contribute"]);
folderRoleAssignments.Add(folderRoleAssignment);
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment