You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function is supposed to apply a PnP Provisioning template to a SharePoint Online site.
Here's the method that applies the template:
ApplyPnPTemplate C# Method
publicstaticasync Task ApplyPnPTemplate(AuthenticationManagerauthManager,stringsiteUrl,ProvisioningTemplatepnpTemplate,bool?clearNavigation,ILoggerlog=null){stringlogPrefix="ApplyPnPTemplate | ";if(pnpTemplate==null)thrownew Exception("PnP Template is null/undefined");using(varctx=await authManager.GetContextAsync(siteUrl)){// Added for testing if this could have something to do with the problem
ctx.RequestTimeout = Timeout.Infinite;ProvisioningTemplateApplyingInformationptai=new ProvisioningTemplateApplyingInformation();if(log!=null){try{
ptai.ProgressDelegate =delegate(Stringmessage,Int32progress,Int32total){
log?.LogInformation(logPrefix+string.Format("{0:00}/{1:00} - {2}", progress, total, message));};
ptai.MessagesDelegate =(message,messageType)=>{ log?.LogInformation(logPrefix+message);};
ptai.SiteProvisionedDelegate =(title,siteUrl)=>{ log?.LogInformation(logPrefix+$"Site Provisioned: {title} ({siteUrl})");};}catch(Exceptionerr){
log?.LogError(logPrefix+ err.Message);throw;}}if(clearNavigation.HasValue){try{
log?.LogInformation($"{logPrefix}Clearing navigation...");
ptai.ClearNavigation = clearNavigation.Value;}catch(Exceptionerr){
log?.LogError(logPrefix+ err.Message);}}try{
ctx.Web.ApplyProvisioningTemplate(pnpTemplate, ptai);}catch(Exceptionerr){
log?.LogError(logPrefix+ err.Message);throw;}}}
I deploy the function to an Azure Function, which has Application Insights enabled.
If I run with a provisioning template without any ClientSidePages defined, the logging works just fine. The Invocation appears under the function log as expected:
The provisioning schema used during testing is attached in this XML file: PP365-Minimumtest.zip
However, if I include ClientSidePages (even just one with the minimum required settings), the logging to Application Insights stops completely. Subsequent calls to the function (or any other functions I have in the same app) won't log to Application Insights at all! I actually have to restart the Function App to make it start logging to Application Insights again.
Funny thing is:
If I run the function locally (debugging from VS), everything works fine. In both cases, I can see that the logging to the Application Insights is completed.
I guess somewhere, maybe in the Azure Function, there is an incompatibility issue. But I cannot find it.
Here are some of the details from the Azure Function:
It's important to mention that the function itself works as expected, and it finishes the run as expected in all cases (as the Log Streams shows). It's only in the Application Insights it fails to complete the logging, and hence mark the run as completed and therefore it won't appear in the Invocation list for the Function App.
I have used many hours trying to figure out why this is failing. Actually, this function is just a small part of a much larger provisioning function we have created. This needs to be upgraded from v2 (for supportability), and then this issue came up.
I hope someone could take some time and look through this, and maybe help me figure out this issue.
Any feedback or comments are appreciated!
Kind regards,
Frank
The text was updated successfully, but these errors were encountered:
Not sure if this is the right place for this post, since it includes so many different components. But here goes...
I have an Azure Function written in C# and developed in Visual Studio 2022.
It runs on .NET 8.0 In-Process, and I'm using PnP.Framework 1.16.0.
Here's the rest of the project details, if needed:
Visual Studio Project Details
The function is supposed to apply a PnP Provisioning template to a SharePoint Online site.
Here's the method that applies the template:
ApplyPnPTemplate C# Method
I deploy the function to an Azure Function, which has Application Insights enabled.
If I run with a provisioning template without any ClientSidePages defined, the logging works just fine. The Invocation appears under the function log as expected:
The provisioning schema used during testing is attached in this XML file:
PP365-Minimumtest.zip
Please see the attachments LogStreamWithNoClientSidePages.txt and ApplicationInsightsWithNoClientSidePages.csv for example results:
LogStreamWithNoClientSidePages.txt
ApplicationInsightsWithNoClientSidePages.csv
However, if I include ClientSidePages (even just one with the minimum required settings), the logging to Application Insights stops completely. Subsequent calls to the function (or any other functions I have in the same app) won't log to Application Insights at all! I actually have to restart the Function App to make it start logging to Application Insights again.
Please see the attachments LogStreamWithClientSidePages.txt and ApplicationInsightsWithClientSidePages.csv for example results:
ApplicationInsightsWithClientSidePages.csv
LogStreamWithClientSidePages.txt
Funny thing is:
If I run the function locally (debugging from VS), everything works fine. In both cases, I can see that the logging to the Application Insights is completed.
I guess somewhere, maybe in the Azure Function, there is an incompatibility issue. But I cannot find it.
Here are some of the details from the Azure Function:
It's important to mention that the function itself works as expected, and it finishes the run as expected in all cases (as the Log Streams shows). It's only in the Application Insights it fails to complete the logging, and hence mark the run as completed and therefore it won't appear in the Invocation list for the Function App.
I have used many hours trying to figure out why this is failing. Actually, this function is just a small part of a much larger provisioning function we have created. This needs to be upgraded from v2 (for supportability), and then this issue came up.
I hope someone could take some time and look through this, and maybe help me figure out this issue.
Any feedback or comments are appreciated!
Kind regards,
Frank
The text was updated successfully, but these errors were encountered: