For sites, we always use the web context to retrieve all the groups for the site. However, I have requirement to retrieve all the users and groups for a list item. The list item has its own permission setting. How can I programmatically retrieve the users and groups (that is tied to the item) and the SPRoleType using Server Side Object Model?


You can simply loop through all SPRoleAssignment in item.RoleAssignments. The Member property gives you the user (actual user or AD group) or the SP group, and the RoleDefinitionBindings gives you the associated role(s) for that member.

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.