2

I have a problem with adding a FBA role to a sharepoint 2013 site programmatically. I tried web.ensureuser method and web.Siteusers.Add() methods and none of them works for me.

SPUser spUser = spWeb.EnsureUser("c:0-.f|ie-fbarolesprovider|groupName");

Thanks

shharepoint developer

1

You can see below link to add fba users

[http://suryapulipati.blogspot.in/2012/07/sharepoint-2010-fba-add-fba-users-to.html]

And for assigning the permissions to the user see the below code:

SPRoleAssignment roleAssignment = new SPRoleAssignment("dom\\user", "user@dom", "user", "some notes");
SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(SPRoleType.Contributor);
roleAssignment.RoleDefinitionBindings.Add(roleDefinition);
if (!myList.HasUniqueRoleAssignments)
{
    myList.BreakRoleInheritance(true); // Ensure we don't inherit permissions from parent
} 
myList.RoleAssignments.Add(roleAssignment);
myList.Update();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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