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
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.