Suppose if you have already bind a sharepoint group to a list item in a custom list/library for integrating permission then later on , if you want to modify the permission for that list item, below is the code snippet to achive it.
SPRoleAssignment objRoleAssignment = objListItem.RoleAssignments.GetAssignmentByPrincipal(objSPGroup);
objRoleAssignment.RoleDefinitionBindings.Remove(web.RoleDefinitions["Full Control"]);
objRoleAssignment.RoleDefinitionBindings.Add(web.RoleDefinitions["Contribute"]);
objRoleAssignment.Update();
Samarendra Swain
This comment has been removed by the author.
ReplyDeleteAwesome something which will be only post by who know how much pain this small snippet would give on given scenario
ReplyDeleteThank you