Break Role Inheritance and add custom role to current item in visual studio 2012 workflow


How to break the role inheritance and add custom users/groups to current item in List using workflow in VS 2012?

In earlier VS 2010 Workflow, the coding was there to do the same. But how to achieve it in VS 2012 workflow?


January 10th, 2014 10:29am


According to your post, my understanding is that you wanted to break Role Inheritance and add custom role to current item in visual studio 2012 workflow.

I recommend to use the below code within workflow:

SPGroup securityGroup = spWeb.SiteGroups["Security Group Name"];  
SPRoleDefinition groupRole = spWeb.RoleDefinitions["Read"];    
SPRoleAssignment roleAssign = new SPRoleAssignment(securityGroup);  
SPListItem listItem = spWeb.GetListItem("http://List Item URL");  

Here is a similar thread for you to take a look at:

Best Regards,

Linda Li

Free Windows Admin Tool Kit Click here and download it now
January 13th, 2014 3:30am


Thanks for the reply.

How to use the code in VS 2012 workflow. I have used the role inheritance break in VS 2010 for SharePoint 2010, but I am not sure how to use in VS 2012 workflow for SharePoint 2013. In VS 2012, the workflow is of "xaml" type.


January 13th, 2014 3:35am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics