SharePoint Online: Apply Theme using PnP Provisioning Template PowerShell

Requirement: Set Theme in SharePoint Online Site using PnP PowerShell Provisioning Template.

How to Change the Site Theme in SharePoint Online using PnP Provisioning Template?
Go to PnP Provisioning Schema repository in GitHub and build your provisioning template., Here is mine:

Provisioning Template Schema XML for Theme:
<?xml version="1.0"?>
<pnp:Provisioning xmlns:pnp="">
  <pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.9.1905.0, Culture=neutral, PublicKeyToken=null" />
  <pnp:Templates ID="CONTAINER-TEMPLATE-a170b11a-d4d3-486f-b191-946ff2acaec3">
    <pnp:ProvisioningTemplate ID="TEMPLATE-a170b11a-d4d3-486f-b191-946ff2acaec3" Version="1" BaseSiteTemplate="SITEPAGEPUBLISHING#0" Scope="RootSite">
      <pnp:Theme Name="Orange" IsInverted="false" />
Make necessary changes and save this as a XML file. E.g. Pnp-Theme.xml

PowerShell to Apply Provisioning Template
Once the template is ready, apply the template to the site using below PnP PowerShell script.
#Config Variables
$SiteURL = ""
$TemplateXML  ="C:\Users\salaudeen\Desktop\Pnp-Theme.xml"
#Connect to PnP Online
Connect-PnPOnline -Url $SiteURL -UseWebLogin

#Apply provisioning Template
Apply-PnPProvisioningTemplate -path $TemplateXML

Here is the script in action
set theme in sharepoint online using pnp provisioning template

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.