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


  • Hi,

    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?


    Friday, January 10, 2014 7:29 AM

All replies

  • Hi,

    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

    Linda Li
    TechNet Community Support

    Monday, January 13, 2014 8:29 AM
  • HI,

    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.


    • Edited by Venkatzeus Monday, January 13, 2014 8:35 AM
    Monday, January 13, 2014 8:34 AM