HI,
How to add claims based user to the sharepoint site programmatically?
I have tried this:
string struserLanID = Convert.ToString(CurrentListItem[userLanId]); SPUser osuser = oSPWeb.EnsureUser(struserLanID); struserLanID = osuser.ToString(); if (!string.IsNullOrEmpty(struserLanID)) { //Grant permission SPRoleAssignment oSPRoleAssignmentManager = new SPRoleAssignment(struserLanID,"", "", ""); oSPRoleAssignmentManager.RoleDefinitionBindings.Add(oSPRoleDefinition); CurrentListItem.RoleAssignments.Add(oSPRoleAssignmentManager); }I get the userLanID as "domain\username". However, I want to convert it to sp2013 claims based user and add it. By giving access to "domain\username", the user is not able to access. I want to convert the user to "
i:0#.w|domain\username" and then add the user. How to achieve it?
Thanks