Skip to main content

Provisioning list through SPFx solution

In this article, we are going to learn How to provision SharePoint assets with SPFx and How to provision multiple instance of assets with SharePoint Framework Solution(SPFx).
SharePoint Framework tool chain allows us to package and deploy SharePoint items with SPFx solution. We can also provision multiple list instances with SharePoint Framework solution.

Follow the steps mentioned below to provision list instance with the SharePoint framework solution:
1. Once you are ready with your SharePoint Framework solution.
2. Create folders for the SharePoint assets:
     A. Create folder with  "sharepoint" name to the root of the solution. 
     B. Create folder with "assets" name inside the "sharepoint" folder.

3.  To provision SharePoint assets to sites with SharePoint Framework(SPFx), we need to create the required xml files. 
    A. Create a file elements.xml in sharepoint\assets folder in your solution.
    B. Copy the below xml code to elements.xml file.
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">
<Field ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" Type="Text" Name="Title" DisplayName="$Resources:core,Title;" Required="FALSE" SourceID="" StaticName="Title" MaxLength="255" />
<Field Name="Email" ID="{0d135b70-fba0-4e81-ab02-fb144779d5af}" DisplayName="Email" Type="Text" />
<ContentType ID="0x010042D0C1C200A14B6887742B6344675C8B"
Name="Test List"
Group="SPFx Content Types"
Description="Test data">
<FieldRef ID="{fa564e0f-0c70-4ab9-b863-0177e6ddd247}" />
<FieldRef ID="{0d135b70-fba0-4e81-ab02-fb144779d5af}" />
Title="Test List"
Description="Test List"
Url="Lists/Test List">
  C. Create a file schema.xml in sharepoint\assets folder in your solution.
  D.  Copy the below xml code to schema.xml file.
<List xmlns:ows="Microsoft SharePoint" Title="Test List" EnableContentTypes="TRUE" FolderCreation="FALSE" Direction="$Resources:Direction;" Url="Lists/Test List" BaseType="0" xmlns="">
<MetaData> <ContentTypes> <ContentTypeRef ID="0x010042D0C1C200A14B6887742B6344675C8B" /> </ContentTypes> <Fields></Fields> <Views> <View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx"> <XslLink Default="TRUE">main.xsl</XslLink> <JSLink>clienttemplates.js</JSLink> <RowLimit Paged="TRUE">30</RowLimit> <Toolbar Type="Standard" /> <ViewFields> <FieldRef Name="LinkTitle"></FieldRef> <FieldRef Name="Email" /> </ViewFields> <Query> <OrderBy> <FieldRef Name="ID" /> </OrderBy> </Query> </View> </Views> <Forms> <Form Type="DisplayForm" Url="DispForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> <Form Type="EditForm" Url="EditForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> <Form Type="NewForm" Url="NewForm.aspx" SetupPath="pages\form.aspx" WebPartZoneID="Main" /> </Forms> </MetaData> </List>
4. Now there is need to made some changes into the package-solution.json.  Copy the below code and paste it  into your package-solution.json file and your file will look likes this.
 "$schema": "", 
"solution": {
   "version": "",
    "includeClientSideAssets": true,
    "isDomainIsolated": false,
    "features": [{
      "title": "list-provision-solution",
      "description": "list-provision-solution",
      "id": "00000000-0000-0000-0000-000000000000",// Replace this with new guid    
      "version": "",
      "assets": {
        "elementManifests": [
  "paths": {
    "zippedPackage": "solution/listprovisioning.sppkg"
Now generate new using online tool and replace the ID.
6. bundle the solution using "gulp bundle" command.
7. Now package the solution using "package-solution" command and deploy it to your SharePoint site.

Provision multiple list instance with SharePoint Framework solution(SPFx)

To provision multiple instance of list, We will create two schema files for ex schema1.xml and
schema2.xml. We can create an schema file as i mentioned above. Also we need one elements.xml file.

Files will be created in assets folder under sharepoint folder.(sharepoint/assets)


1. Create elements.xml and schema files(schema1.xml and schema2.xml) inside the assets folder.
Two schema files
2. Once the schema files are created, We need to mentioned both the files in our elemenst.xml file.
3. Mention all the schema files in the package-solution.json.
In this way, You can provision multiple lists using SPFx solution.
For more details follow :


Post a Comment

Popular posts from this blog

SPFx Interview Questions With Answers

In this article, we are going to discuss interview questions related to the SPFx (SharePoint Framework Development ). It will help you to prepare for the interview and in getting clarity on the core concepts of SPFx development. What is SPFx? SPFx, short for SharePoint Framework,  SPFx  allows us for client-side SharePoint development, we can easily connect with SharePoint data and it also supports for open source tools. What is the major difference between SPFx web part and the SharePoint app? Both the development model supports client-side development but the major difference between these two is that the SharePoint app(add-in) runs on the iframe. What you can build with SPFx? Using SPFx framework we can customize the SharePoint pages. We can build things mentioned below using the SharePoint Framework(SPFx). Web parts, Extensions, Adaptive Card, Library Component How many types of extensions we can create using SPFx? SPFx has three extension types: Application Customizers: Using the

How to register an app in SharePoint

In this article, we are going to learn how to register an app/add-in in SharePoint online. If you have created a Sharepoint provider-hosted add-in or other SharePoint solution and to access the SharePoint site or list using the app/add-in you need to register the add-in on SharePoint and to grant permission. Register app in SharePoint 1. Login into SharePoint and Navigate to register an app page. Use the URL mentioned below:          [Sitecollection URL]/_layouts/15/appregnew.aspx 2.  Once you navigate to the Register app page, a form will open. You need to fill all the fields on the form. Client Id and Client Secret  generated when we click on the generate button available next to the fields.  Title : Name of the add-in which you want to give. App Domain : Where your domain is hosted, for the local environment you can place             "". Do not include HTTP or HTTPS in App Domain. Redirect URL :  Insert the redirect URL, for t

Permission XML for SharePoint Add-in

In this article, we will be discussing the permission XMLs, which are used to provide permission to SharePoint add-in. Permission XML for the SharePoint app. You can set the App only permission, by setting "true" or "false" in  AllowAppOnlyPolicy=“true” in these permission XMLs.   If add-in granted permission to tenant scope, It includes all children in scope. Before granting access to the app, need to register an app. Follow this link for step by step guide to  How to register an app/add-in in SharePoint   Providing access to add-in at tenant level: To provide access at tenant level user must have the tenant admin level permission. To grant this permission tenant admin can use this URL Search the App Id (Client ID) and it will fetch all the information which you provide at time of registration of app.   Assign full control at tenant level : <AppPermissionRequests AllowAppOnlyPolicy="true&quo