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

Fetch the Group permission level and assign to listitem

$
0
0

Hi,

I have a SPGroup. I want to find the permission of the group using C#? How to achieve this?

I am trying to assign the Group permission to a list item.

I have used the below code, but not sure, if it is correct:

 private void AddRoles(SPWeb sPWeb, SPPrincipal spGroup, SPListItem item)
        {
            if (spGroup != null)
            {
                SPRoleAssignment oRoleAssignment = sPWeb.RoleAssignments.GetAssignmentByPrincipal(spGroup);

                item.RoleAssignments.Add(spGroup);

            }
        }
If the custom group has Read permission, I want to assign the read permission to the listitem. How to achieve this?

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>