Monthly Archives

Březen 2015

FBA roles and SPRoleAssignment

By | SharePoint | No Comments

Still unable to set SPListItem permissions to FBA role in .Net Framework 3.5? Use the direct name of your FBA rule in claim form to make it working.

SPRoleDefinition spRole = elevatedWeb.RoleDefinitions["Read"];
SPRoleAssignment roleAssignment = new SPRoleAssignment("c:0-.f|roleprovidername|rolename", null, "rolename", null);
roleAssignment.RoleDefinitionBindings.Add(spRole);
Item.RoleAssignments.Add(roleAssignment);
Item.Update();