Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Need to automate the custom permission level creation and groups.

Please give me some pointers which can guide me to create a feature to add a custom permission level and groups and staple the same with site def

share|improve this question

2 Answers 2

up vote 1 down vote accepted

As far as writing a feature, I've outlined how to do that with event receivers here.

You'll just need to replace the code to add event receivers with your code to add permission levels and groups. Also, at the bottom of the post I talk about how to staple it to a specific site definition.

Permission levels are called roles in the api. You will want to create a new SPRoleDefinition, configure the name and basepermissions, and then add it to the SPWeb.RoleDefinitions collection.

Groups are called groups in the api. You will want to call SPWeb.Groups.Add to create a group.

I hope this all makes sense.

share|improve this answer

As Steve suggests, SPRoleDefinition is the way to go together with SPRoleAssignment. If you are migrating from SharePoint 2003 to SharePoint 2007 your SPRole class would still work but I suggest migrating that part of code to the new classes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.