Modernization AddOn
See original GitHub issueDoes the Modernization support AddOn when running from Pnp.Powershell? I am getting below error message when trying. Might be that I’m doing something wrong?
_Constructor on type 'Contoso.Modernization.MyCustomFunctions' not found. at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, Object[] args)
at PnP.Framework.Modernization.Functions.FunctionProcessor..ctor(ClientContext sourceClientContext, ClientContext targetClientContext, IPage page, PageTransformation pageTransformation, BaseTransformationInformation baseTransformationInformation, IList`1 logObservers)
at PnP.Framework.Modernization.Transform.ContentTransformator..ctor(ClientContext sourceClientContext, ClientContext targetClientContext, IPage page, PageTransformation pageTransformation, BaseTransformationInformation transformationInformation, IList`1 logObservers)
at PnP.Framework.Modernization.Publishing.PublishingPageTransformator.Transform(PublishingPageTransformationInformation publishingPageTransformationInformation)_
Reproduction steps I’m following the steps described here
Create class. (I have tried .NET Core 3.1 / .NET Framework 4.6.1 / .NET 5.0, but no difference) Note that the instruction in the link above is using SharePointPnP.Modernization.Framework.Functions, but when using the new version it should be PnP.Framework.Modernization.Functions?
using Microsoft.SharePoint.Client;
using PnP.Framework.Modernization.Functions;
using System;
namespace Contoso.Modernization
{
public class MyCustomFunctions : FunctionsBase
{
public MyCustomFunctions(ClientContext clientContext) : base(clientContext)
{
}
public string MyListAddServerRelativeUrl()
{
return "SomeString";
}
}
}
Then I add this to the webpartmapping.xml (Issue comes directly when adding this to the mapping file, so in the example here I haven’t started to use it in the actual mapping)
<AddOn Name="Custom" Type="Contoso.Modernization.MyCustomFunctions" Assembly="C:\ClassLibrary1\bin\Debug\net461\ClassLibrary1.dll" />
Then call migration using
ConvertTo-PnPPage -ClearCache -Identity testmigration.aspx -TargetPageName TestMigration.aspx -PublishingPage -Overwrite -TargetConnection $global:target -Connection $global:source -WebPartMappingFile ($PSScriptRoot + "\PageLayoutMappings\webpartmapping.xml") -SkipItemLevelPermissionCopyToClientSidePage -SetAuthorInPageHeader -KeepPageCreationModificationInformation -LogType File -LogVerbose -LogFolder ($PSScriptRoot + "\Logs");
I am using PnP.Powershell v. 1.5.0 and PnP.Framework v.1.4.0 Conversion from SP2016 publishing pages to SP online Modern Pages
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
Sorry, did not have time to try, hope next week looks better. The use case was to identify some more special cases of cewp usages like iframes, specific js code that should be mapped to custom web parts etc. Thanks for following up
Is there any update over this. My use case is disabling all the content logic extraction from Content Editor Webpart and directly map to React Modern Script webpart. Can I achieve this using AddOn model?