Hi
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?
Code:
var authManager = AuthenticationManager.CreateWithCertificate(settings["azureAppId"].Value, settings["certPFX"].Value, settings["PFXPW"].Value, settings["azureTenantName"].Value);
Console.WriteLine("Created auth method");
try
{
using (var ctx = authManager.GetContext(SPOAddress))
{
// Connect and get lists
ctx.Load(ctx.Web);
ctx.ExecuteQuery();
var list = ctx.Web.Lists.GetByTitle(listTitle);
var contentTypes = list.ContentTypes;
ctx.Load(list);
ctx.Load(contentTypes);
ctx.ExecuteQuery();
// 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);
}
}