We want to enable some SharePoint features during the provisioning process. In our PnP-Template there are three GUIDs of features, which have to be enabled:
<?xml version="1.0" encoding="utf-8" ?>
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2016/05/ProvisioningSchema">
<pnp:Preferences Generator="OfficeDevPnP.Core, Version=2.17.1708.1, Culture=neutral, PublicKeyToken=3751622786b357c2" />
<pnp:Templates ID="CONTAINER-TEMPLATE-F207AD80A5E746C9B3F9955B844AA650">
<pnp:ProvisioningTemplate ID="MANDANT-SITE" Version="1">
<pnp:Features>
<pnp:SiteFeatures>
<!-- Publishing Site Feature -->
<pnp:Feature ID="f6924d36-2fa8-4f0b-b16d-06b7250180fa" />
<pnp:Feature ID="8A4B8DE2-6FD8-41e9-923C-C7C3C00F8295" />
</pnp:SiteFeatures>
<pnp:WebFeatures>
<!-- Publishing Web Feature -->
<pnp:Feature ID="94c94ca6-b32f-4da9-a9e3-1f3d343d7ecb" />
</pnp:WebFeatures>
</pnp:Features>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>
Sometimes this process stucks. Mostly the first feature (SharePoint Publishing Infrastructure) works well. But than the SharePoint Online does no response. I do not get any error, exception or something else. The other features are not enabled... When I stop the Azure WebJob (cmd-application) and start it again - all features will be enabled.
The following calls the PnP-Template:
var provisioningInfo = new ProvisioningTemplateApplyingInformation();
provisioningInfo.ProgressDelegate = (message, step, total) =>
{
Log.InfoFormat("Applying provisioning template - step {0}/{1} : {2}", step, total, message);
Console.WriteLine("Applying provisioning template - step " + step + "/" + total + ":" + message);
***AFTER THIS Console.WriteLine NOTHING HAPPENS ANYMORE***
};
Console.WriteLine("Try to provisioning");
Thread.Sleep(10000);
try
{
UsingContext(siteRequest.Url, ctx =>
{
Console.WriteLine("Try to get client context of provisioning");
Thread.CurrentThread.RunWithCulture((int)siteRequest.Lcid, () =>
{
Console.WriteLine("Start ApplyProvisioningTemplate");
ctx.Site.RootWeb.ApplyProvisioningTemplate(provisioningTemplate.OriginalTemplate, provisioningInfo);
provisioningTemplate.Provision(ctx);
Console.WriteLine("End ApplyProvisioningTemplate");
});
});
}
catch (Exception ex)
{
Console.WriteLine("An error occured while applying the provisioning template. " + ex);
Log.Error("An error occured while applying the provisioning template.", ex);
throw new ProvisioningTemplateException(ex.Message, ex);
}
What is the reason for this behaviour? Is there a timeout, because enabling the SharePoint Publishing Infrastructure takes round about three minutes?
It would be nice to solve this issue.