Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First you create a group for this permission type. You do that from the "People and Groups" page.<br> Then you go to your Pages list by browsing to the http:/Pages.<br> Click on the drop down menu on the page/item in question and select "manage permissions". On the Actions menu, select "Edit permissions" and click Ok to break inheritance.<br> Remove the default (inherited) permissions (user/groups) by put a check mark in them and select Action-s>Remove User Permissions.<br> On the New menu, select "Add users", enter the name of your group , select the desired permissions and click Ok.</p> <p>And here's how to do it programmatically:</p> <pre><code>using (SPSite site = new SPSite("&lt;YOUR URL&gt;")) { using (SPWeb web = site.OpenWeb()) { // Get the group you want to assign to the item SPGroup group = web.Groups["&lt;YOUR GROUP NAME&gt;"]; SPPrincipal principal = group as SPPrincipal; // Define the role definitions SPRoleDefinitionCollection roleDefinitions = web.RoleDefinitions; SPRoleDefinition[] rolesToApply = new SPRoleDefinition[1] { roleDefinitions["Contribute"] }; // Or whatever role definition you want to assign SPRoleAssignment newRoleAssignmentToAdd = new SPRoleAssignment(principal); foreach (SPRoleDefinition roleDefinition in rolesToApply) { if (roleDefinition != null) { newRoleAssignmentToAdd.RoleDefinitionBindings.Add(roleDefinition); } } // Choose your list SPList list = web.Lists["Pages"]; // Query for the item/file/page SPQuery query = new SPQuery(); query.RowLimit = 2000; query.ViewFields = "&lt;FieldRef Name='Title' /&gt;"; query.Query = string.Format(@"&lt;OrderBy&gt;&lt;FieldRef Name='ID'/&gt;&lt;/OrderBy&gt; &lt;Where&gt; &lt;Eq&gt; &lt;FieldRef Name='FileLeafRef'/&gt; &lt;Value Type='Text'&gt;{0}&lt;/Value&gt; &lt;/Eq&gt; &lt;/Where&gt;", "&lt;YOUR PAGE NAME&gt;"); // Get the list item SPListItemCollection items = list.GetItems(query); if (items.Count &gt; 0) { SPListItem item = items[0]; // If the item doesn't have unique permissions, set it to have that if (!item.HasUniqueRoleAssignments) { item.BreakRoleInheritance(false); } // Add your role definition item.RoleAssignments.Add(newRoleAssignmentToAdd); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload