SharePoint Framework advanced assets provisioning

Well, the Onet.xml definitions are not dead!


We can still take the advantage of some of the knowledge we learned some time ago from the SharePoint farm solutions (full trust solutions). Understanding the Onet.xml files was not easy at all, but whoever still possesses that knowledge can use it in some modern SharePoint Online scenarios.


What we can include in the Emelemts.xml definition file


The list of possible elements expected for now is CustomAction, ClientWebPart, ClientSideComponent, Field, ContentType, ListInstance, Module, PropertyBag. That means that we can provision with the SPFx solution package the following:


  1. Document Library (ListInstance).
  2. Custom Lists (ListInstance).
  3. Custom List and Library Schemas (CustomSchema).
  4. Web and List PropertyBag properties (PropertyBag).
  5. Site Columns (Field).
  6. Content Types (ContentType).
  7. Images and other types of files e.g .xlsx, .docx templates (Module).
  8. Custom Actions (CustomAction).
  9. Modern Site Pages with even our custom SPFx Client side webparts predefined on them. Please note Site Page is available for SharePoint Online only (Module).
  10. Old Wiki Pages and Web Part Pages (Module).
  11. Pre-populated list and library items as part of the ListInstance or CustomSchema, but please do not do it. If you ever re-activate that feature the pre-populated data would double.


All of the mentioned components can be deployed at once with the SPFx solution package when the app is added to a SharePoint site.


Here is a quick video with PnP SharePoint Framework sample included:


SPFx Tenant Scoped Deployment does not support provisioning assets with onet.xml


If the skip feature deployment is enabled in the SPFx package solution, then the SPFx solution would be enabled and available cross all site collections and sites in tenant. However "skipFeatureDeployment" simply means that our elements.xml files would be skipped because they are part of the old feature deployment system.


Where are the Site Template and the Web Template?


Site and Web Templates cannot be added to SPFx solution package because SPFx solution can be installed on already existing site (SPWeb), but the use of those templates was not really recommended way before the modern SPFx client side solutions because of bad SharePoint upgrade and update experience. Use the PnP provisioning engine for that. The engine is also the way to go, if you would like to deploy complex site collection and sub web hierarchies.


Conclusion


If there is a need to encapsulate everything in the SPFx solution package and being installed as one SharePoint app in a site, then the above might be a very good option. If I have the chance to provision it by the help of the PnP provisioning engine, then I would do it because it is more flexible for future updates.


SharePoint PnP provision assets sample