Apr 25 2017 07:11 AM
I'm currently using the XMLTemplateProvider class to load an xml template and apply it to the site. This works fine.
The issue is that this interface only takes a file and I'd like to store the model templates in a SharePoint list.
So I have to read the bytes from SharePoint and write a local temp file then delete it when the provisioning is complete.
I saw the class SPSiteTemplateManager
it looked like this might be able to load the template directly from a SharePoint list, but I haven't found any additional information on how I might use this.
Is this feasable and if so is there any kind of sampel code or documentation around this ?
Thanks
Apr 25 2017 07:26 AM
@Mikael Svenson recently described a provisioning approach that uses a SPO list in an interview with @Tobias Zimmergren which may be of interest, check it out at https://rencore.com/blog/rencore-techtalks-episode-6-a-take-on-the-office-365-pnp-provisioning-engin....
They may be able to provide some specific guidance
Apr 25 2017 07:31 AM - edited May 02 2017 12:11 PM
I've created a sample in the powershell project that takes configurations from a file. I could add a solutions to that sample that reads from a SharePoint list:
https://veenstra.me.uk/2017/04/19/office-365-sharepoint-20132016-moving-sites-around/
Are you using the core libraries or would PowerShell be an option?
May 02 2017 01:08 PM - edited May 02 2017 01:21 PM
Have you looked at the code in the PnP Partner Pack for provisioning? They create an Infrastructure site collection and store all the PnP provisioning template XML files in doc libraries.
https://github.com/SharePoint/PnP-Partner-Pack
You can still use the XMLTemplateProvider, but instead of the XMLFileSystemTemplateProvider, use the XMLSharePointTemplateProvider (part of PnP Core) and pass in context, Web URL and ensure the list item has a File property.
Then using the ProvisioningTemplate class to to hold the template from the XML provider using the provider.GetTemplate(item.File.Name) method.
ProvisioningTemplate template = provider.GetTemplate(item.File.Name);
You can look at the source code starting at line 50 - 111
SharePointProvisioningRepository.cs
Thanks