How to create a Promoted list in SharePoint 2010/2013/2016 or Online using PnP CSOM?
Hello SharePointers
Below is the PnP CSOM script to create a promoted list in SharePoint 2010/2013/2016 or Online using PnP CSOM Script.
$ListTemplateInternalName = “PromotedList.stp”
$Context = Get-PnPContext
$Web = $Context.Site.RootWeb
$ListTemplates = $Context.Site.GetCustomListTemplates($Web)
$Context.Load($Web)
$Context.Load($ListTemplates)
Execute-PnPQuery
$ListTemplate = $ListTemplates | where { $_.InternalName -eq $ListTemplateInternalName }
if ($ListTemplate -eq $null)
{
Throw [System.Exception] “PnP Template not found”
}
$ListCreation = New-Object Microsoft.SharePoint.Client.ListCreationInformation
$ListCreation.Title = ‘Type of Requests’
$ListCreation.TemplateFeatureId = “192efa95-e50c-475e-87ab-361cede5dd7f”
$ListCreation.TemplateType = 170
$Web.Lists.Add($ListCreation)
Execute-PnPQuery
Happy SharePointing 🙂