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

I am using the SharePoint Object Model to create new sites programmatically (with a custom web part). It works fine but I am wondering if it is possible to grant permission for groups as well?

When I create the site I have set it to not inherit permission:

newWeb = SPContext.GetContext(HttpContext.Current).Web.Webs
    .Add(siteUrl, siteName, siteDescription, (uint)1033, siteTemplate, true, false);

In the GUI I can then go to Site Actions (on the newly created site) -> Grant Permission -> search for groups in the parent site and then grant permission for this group. So, in the parent site myGroup can have Full Access permissions but in this site I can set it to Contribution or whatever. Is it possible to do this when I create the site or just after (programmatically)?

share|improve this question

1 Answer 1

Your Answer


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