SharePoint Add-in Recipe - Site Provisioning
configure site collections, configure sub sites, create site collections, create sub sites, Office 365, Office 365 Patterns and Practices Guidance, OfficeDev, patterns and practices, PnP guidance, SharePoint 2013
The approach you take to provision site collections and sub sites sites is different in the new SharePoint Add-ins than it was with Full Trust Code. In a typical Full Trust Code (FTC) / Farm Solution scenario, site collections and sub sites are created with the site definitions and web templates and declarative code is used to configure the sites and apply customization. In this model, declarative code is typically used to create site columns, content types, lists defined in XML and SharePoint's feature framework elements are used to package and deploy them.
In a SharePoint Add-in model scenario, site collections and sub sites are created and configured with the SharePoint Client Side Object Model (CSOM). This pattern is commonly referred to as the remote provisioning pattern.
At a high level, The remote provisioning pattern looks like this:
You can read the rest of this Office 365 Patterns and Practices Guidance article on GitHub, here: https://github.com/OfficeDev/PnP-Guidance/blob/master/articles/SharePoint-Add-In-Recipe-site-provisioning.md