Thursday, November 23, 2017

PnP- Example using XMLSharePointTemplateProvider , CSOM

I was working
on PnP site provisioning, and looking for an example for using the
PnP XMLSharePointTemplateProvider class. No documentation or example I found in detail.

Problem was:

In all the examples/samples code written or get
on git is follow the sequence of getting the web template and apply it to new. Function
used are GetProvisioningTemplate and followed by ApplyProvisioningTemplate.
I was having scenario like, I extracted the XML template once, stored at
central location on my SharePoint Online tenant in document library. Wanted to
reuse the same template for the every time when user runs the site provisioning.
(Technically skip calling the GetProvisioningTemplate step)

After digging into the PnP.core framework code, found some test
cases related to XMLSharePointTemplateProvider thatgave
some detail about how and what parameters need to pass to achieve this
scenario.