Avatar of tikeem
tikeem

asked on 

Sharepoint Item Level Permissions

Whenever I add an Item with Item level permission to a List/Library, that user is added with Limited Access permission to that List/Library. May be beacuse of this, when the document is opened for editing hangs the system.
if (!spfile.Item.HasUniqueRoleAssignments)
      spfile.Item.BreakRoleInheritance(true);
web.AllowUnsafeUpdates = true;
 
#region REMOVE ALL USER'S PERMISSIONS
SPRoleAssignmentCollection spRoles = spfile.Item.RoleAssignments;
for (int j = spRoles.Count - 1; j > -1; j--)
spRoles.Remove(j);
#endregion
 
SPRoleDefinition RoleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
SPRoleAssignment RoleAssignment = new SPRoleAssignment(UserID, "email", "name", "notes");
RoleAssignment.RoleDefinitionBindings.Add(RoleDefinition);
web.AllowUnsafeUpdates = true;
spfile.Item.RoleAssignments.Add(RoleAssignment);

Open in new window

Microsoft SharePoint

Avatar of undefined
Last Comment
Larso76

8/22/2022 - Mon