You can use top-level Web site and subsites to divide site content into distinct, separately manageable sites. Top-level Web sites can have multiple subsites, and subsites can also have multiple subsites, down as many levels as your users need. The entire structure of a top-level Web site and all of its subsites is called a Web site collection. The following diagram shows this hierarchy of sites and subsites.
However, create a team site programmatically can be a challenging process. Sure, if you’re trying to spawn a website with no persmissions, user groups, etc then creating a team site is a trivial process. Creating custom permissions, custom look and feel, custom user groups, assigning custom permissions to these user groups, can be a tedious process.
In this post, I’ll try to cover the following:
- Create a Team Site (Under a specific root site) using a “Site Template“
- Create Custom Membership Groups
- Add Users to these Membership Groups
- Assign Site Specific Permissions to these Groups.
- Customize the look and feel of specific web parts on the new site.
Note: Please keep in mind, the methodology used for creating these sites, is just one of the many approaches that can be adopted to achieve this goal. If you have a better way of doing the same, please leave a link to your blog in the comments section below. This code was hashed out in a couple of days when I was trying to meet a really tight deadline – it can be refactored and further improved upon.
Update:
This blog turned out to be too long, I’ve posted the code to this post instead. CreateTeam.cs