Using PowerShell to Set Available Web Templates via CSOM in SharePoint Online / Office 365


Sometimes, the easiest way to deploy some additions, or updates in an already deployed SharePoint Online solution, is using PowerShell.

In my case, I had the requirement of updating some Web Templates in a Office 365 Intranet and enable these Web Templates to be used in several sites that were already provisioned. So, ideally to achieve a clean Upgrade,  we should edit the Web Template to add the changes and do the feature upgrade to implement the change for future sites created and for the already created sites, we just update the Avaliable Web Templates using PowerShell.

Updating Available Web Templates

There is no easy way to update Available Web Template using Client Object Model (CSOM, JSOM), I mean, we don’t have any property or method to do it. Instead we should use a Web-based property bag called __WebTemplates. This property bag is used to read and write this property in the Server Object Model dlls.


If we analyze little bit more the value of the Property Bag we can see the format used to store this property is XML: image


In this post we will use PowerShell to Add more Web Templates to the Available List by setting properly “__WebTemplates” property bag.



Author: José Quinto
Copyright Notice: All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.