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.
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.
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
thank a lot i want to provision a Lookup field but it not works
Group="NEOS Site Columns"
Hey MBaye, I have not tried to provision lookup fied so far. Will test in the next weeks and let you know If I have any success.
Meanwhile you can try the definitions from this blog and see if it works for you:
It seems that some file types can't be deployed through the assets folder. I tried to deploy a custom CSS file by adding it to the assets folder and defining the target location in a module in the elements.xml. When I upload the solution package to the app catalog, I get an error that a part is missing. Any idea about that?
I have the same issue as Andreas Thumfart. Any help will be highly appreciated!
Any feedback about create lookup fields?
Any feedback about create lookup field?