Add Custom Permission to Group
I want to add Custom Permission To group using Visual Studio 2012..please help me...
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Pankit PatelPosted Sep 13, 2014, 2:20 AM
Manesh GolekarPosted Sep 12, 2014, 7:11 PM
This should work for You ..
SPWeb web = SPContext.Current.Web;
SPGroup group = web.SiteGroups["Group Name"];
SPRoleDefinition rDefination = web.RoleDefinitions.GetByType(SPRoleType.Reader);
SPRoleAssignment rAssignment = new SPRoleAssignment(group);
rAssignment.RoleDefinitionBindings.Add(rDefination);