SharePoint Framework advanced assets provisioning


I recently created example that shows how we can provision SharePoint components based on the old Onet.xml files (SharePoint Features framework) with SPFx solution package.

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:
- Document Library (ListInstance).
- Custom Lists (ListInstance).
- Custom List and Library Schemas (CustomSchema).
- Web and List PropertyBag properties (PropertyBag).
- Site Columns (Field).
- Content Types (ContentType).
- Images and other types of files e.g .xlsx, .docx templates (Module).
- Custom Actions (CustomAction).
- 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).
- Old Wiki Pages and Web Part Pages (Module).
- 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
Posted on

Tags: SharePoint, SFPx assets, Feature framework, onet.xml, ListInstance, CustomSchema, package-solution, install app, Elements.xml, Feature.xml, PnP provisioning

Comments