Using FormsManager with PnP.Framework

Hi :slight_smile:
I am trying to utilise FormsManager to auto-deploy some forms using the PnP.Framework nuget. I can get authenticated, return the list etc however when I come to forms.GenerateForms it throws an error about requesting credentials. Is there a way I can use it with the AuthManager I have already created?


var authManager = AuthenticationManager.CreateWithCertificate(settings["azureAppId"].Value, settings["certPFX"].Value, settings["PFXPW"].Value, settings["azureTenantName"].Value);
Console.WriteLine("Created auth method");

    using (var ctx = authManager.GetContext(SPOAddress))
        // Connect and get lists
        var list = ctx.Web.Lists.GetByTitle(listTitle);
        var contentTypes = list.ContentTypes;

        // Upload the form for the requested Content Type
        var cType = contentTypes.FirstOrDefault(ct => ct.Name == contentTypeName);
        var forms = new FormsManager(ctx, list.Id, cType.Id.ToString());
        var layout = XDocument.Load(PlumsailPath);
        forms.GenerateForms(Guid.Empty, FormTypes.New, layout);
        forms.GenerateForms(Guid.Empty, FormTypes.Edit, layout);
        forms.GenerateForms(Guid.Empty, FormTypes.Display, layout);

Dear @astokes,
Seems like the following approach is not supported right now, our dev team will research if it's possible to implement in the future. For now, we recommend using the described approach - Plumsail Forms Provisioning example for SharePoint — SharePoint forms

1 Like

Hi Nikita,

Thanks for getting back to me - unfortunately the auth method in that page has been deprecated by Microsoft hence the switch to PnP.Framework in a .Net 6.0 project

Switched to 4.8 and working ok now :slight_smile:

Many Thanks,

1 Like