Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Is it possible to add user in SPRoleAssignment based on domain\username only

$
0
0

Hi,

I am trying to explicitly grant permission to a user in a custom list.

I had checked the SPRoleAssignment property.

http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.sproleassignment.aspx

However, will the role assignment work, if  the loginname is only passed?

Below is the code which I mean:

//CurrentListItem is the SPListItem data
SPRoleDefinition oSPRoleDefinition = oSPWeb.RoleDefinitions[Custom Role];
SPRoleAssignment oSPRoleAssignmentuser = new SPRoleAssignment("domain\userid","","","");
                    oSPRoleAssignmentUser.RoleDefinitionBindings.Add(oSPRoleDefinition);
CurrentListItem.RoleAssignments.Add(oSPRoleAssignmentUser);

Thanks


Viewing all articles
Browse latest Browse all 11571

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>