banner



How To Create A List Template In Sharepoint

  • Srikanta Barik
  • Updated date Mar 18, 2021
  • 18.3k
  • 5

On this blog, here I am going to draw nearly how we tin save a list as a template in SharePoint online using Ability Shell.

Introduction

In SharePoint, the list templates provide re-usability of columns without recreating it on every single site. For e.one thousand. I have created a custom list which name is Project, in a SharePoint site collection with all relevant columns, At present I want this list structure in other site collections, without recreating the listing on every single site.

Steps to save a list or library as a template

Step-1

Go to a SharePoint list, then navigate to list settings nowadays nether the listing tab on the ribbon and then click on Listing Settings.

Step-ii

Click on Salvage list as Template nether Permissions and Management group.

Save A List As Template In SharePoint Online Using PowerShell

Step-3

Provide template Filename and Template proper noun. If you want to include the content, then select the check box, Click Ok

Save A List As Template In SharePoint Online Using PowerShell

Footstep-iv

Click OK on the success page.

Save A List As Template In SharePoint Online Using PowerShell

How to download the list template

Step 1

Go to site setting, Click on Listing Templates under web Designers and Gallery.

Pace 2

Click on Upload Document on the Files tab, then browse your file i.e-Demo.end

Save A List As Template In SharePoint Online Using PowerShell

Y'all can also save the list template to your site past using PowerShell script,

  1. endeavor  {
  2.     Add - Type - Path"..\Microsoft.SharePoint.Client.dll"
  3.     Add - Blazon - Path"..\Microsoft.SharePoint.Customer.Runtime.dll"
  4.     $SiteUrl = Read - Host"Enter the SiteUrl"
  5.     $UserName = Read - Host"Enter the username"
  6.     $Countersign = Read - Host - AsSecureString Password
  7.     $ctx = New - Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
  8.     $Credentials = New - Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $Password)
  9.     $ctx.Credentials = $credentials
  10.     $Web = $Ctx.Web
  11.     $site = $Ctx.Site
  12.     $ctx.Load($web)
  13.     $ctx.Load($site)
  14.     $ctx.ExecuteQuery()
  15.     $ListName = Read - Host"Enter the List Proper noun"
  16.     $list = $Ctx.Web.lists.GetByTitle($ListName)
  17.     $FileName = Read - Host"Enter the File Proper noun"
  18.     $TemplateName = Read - Host"Enter the Template Name"
  19.     $listing.SaveAsTemplate($FileName, $TemplateName,"list template description" , $ true )
  20.     $ctx.ExecuteQuery()
  21.     Write - Host - ForegroundColor Green"Successfully save the listing Template."
  22.     sleep x
  23. }catch  {
  24.     Write - Host - ForegroundColor Crimson'Mistake ' , ':'
  25.     $Mistake[0].ToString();
  26.     sleep 10
  27. }

Follow the below screenshot and enter the values into the parameters appropriately. Then you can get a successful bulletin.

Save A List As Template In SharePoint Online Using PowerShell

How to upload list template to another site

stride 1

Get to site setting, Click on List Templates under spider web Designers and Gallery.

Pace 2

Click on Upload Document in the Files tab, Then browse your file i.e-Demo.stp

Save A List As Template In SharePoint Online Using PowerShell

Save A List As Template In SharePoint Online Using PowerShell

Stride three

Save the list template.

Save A List As Template In SharePoint Online Using PowerShell

Save A List As Template In SharePoint Online Using PowerShell

Step 4

Become to Site contents, Click on New then select App.

Save A List As Template In SharePoint Online Using PowerShell

Pace 5

Select your template.

Save A List As Template In SharePoint Online Using PowerShell

Step 6

Provide a list Name.

Save A List As Template In SharePoint Online Using PowerShell

Step 7

At present your list added to the site successfully.

Save A List As Template In SharePoint Online Using PowerShell

You can besides add the list template to your site by using PowerShell script,

  1. try  {
  2.     Add together - Blazon - Path"..\Microsoft.SharePoint.Customer.dll"
  3.     Add - Type - Path"..\Microsoft.SharePoint.Client.Runtime.dll"
  4.     $SiteUrl = Read - Host"Enter the SiteUrl"
  5.     $UserName = Read - Host"Enter the username"
  6.     $Password = Read - Host - AsSecureString Countersign
  7.     $ctx = New - Object Microsoft.SharePoint.Client.ClientContext($siteUrl)
  8.     $Credentials = New - Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $Countersign)
  9.     $ctx.Credentials = $credentials
  10.     $Spider web = $ctx.Web
  11.     $site = $ctx.Site
  12.     $ctx.Load($spider web)
  13.     $ctx.Load($site)
  14.     $ctx.ExecuteQuery()
  15.     $Template = $site.GetCustomListTemplates($Spider web)
  16.     $Lists = $ctx.Web.Lists
  17.     $ctx.Load($Lists)
  18.     $ctx.Load($Template)
  19.     $ctx.ExecuteQuery()
  20.     $TemplateName = Read - Host"Enter the Template Name"
  21.     $ListName = Read - Host"Enter the List Name"
  22.     $ListTemplate = $Template | where {
  23.         $_.Name - eq $TemplateName
  24.     }
  25.     $Listing = $Lists | where {
  26.         $_.Title - eq $ListName
  27.     }
  28.     If($List - eq $Null) {
  29.         $ListCreation = New - Object Microsoft.SharePoint.Client.ListCreationInformation
  30.         $ListCreation.Title = $ListName
  31.         $ListCreation.ListTemplate = $ListTemplate
  32.         $List = $Lists.Add together($ListCreation)
  33.         $ctx.ExecuteQuery()
  34.     }
  35.     Write - Host - ForegroundColor Green"Successfully Add the list."
  36.     sleep 10
  37. }catch  {
  38.     Write - Host - ForegroundColor Red'Error ' , ':'
  39.     $Error[0].ToString();
  40.     sleep ten
  41. }

Follow the below screenshot and enter the values for the parameters accordingly. And then y'all tin get a successful message.

Save A List As Template In SharePoint Online Using PowerShell

How To Create A List Template In Sharepoint,

Source: https://www.c-sharpcorner.com/blogs/save-a-list-as-template-in-sharepoint-online-using-powershell

Posted by: wardsleve2000.blogspot.com

Related Posts

0 Response to "How To Create A List Template In Sharepoint"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel