Provisioning Engine: Exception-The field was found invalid when applying Provisioning template

New Contributor


 When I am applying my provisioning template to a newly created team site it is throwing an exception "The field was found invalid:" Below is my  CSOM code.

private static void ApplyProvisioningTemplateNew(ConsoleColor defaultForeground, string webUrl, string userName, SecureString pwd)
using (var ctx = new ClientContext(webUrl))
// ctx.Credentials = new NetworkCredentials(userName, pwd);
//ctx.Credentials = new SharePointOnlineCredentials(userName, pwd);
ctx.RequestTimeout = Timeout.Infinite;

// Just to output the site details
Web web = ctx.Web;
ctx.Load(web, w => w.Title);

Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("Your site title is:" + ctx.Web.Title);
Console.ForegroundColor = defaultForeground;

// We could potentially also upload the template from file system, but we at least need this for branding file
XMLTemplateProvider provider =
new XMLFileSystemTemplateProvider(@"C:\Nabhendu\KNECT", "");
ProvisioningTemplate template = provider.GetTemplate(@"C:\Nabhendu\KNECT\PnPProvisioningDemo.xml");

ProvisioningTemplateApplyingInformation ptai
= new ProvisioningTemplateApplyingInformation();
ptai.ProgressDelegate = delegate(String message, Int32 progress, Int32 total)
Console.WriteLine("{0:00}/{1:00} - {2}", progress, total, message);

//// Associate file connector for assets
FileSystemConnector connector = new FileSystemConnector(@"C:\Nabhendu\KNECT", "");
template.Connector = connector;

//// Since template is actual object, we can modify this using code as needed
//template.Lists.Add(new ListInstance()
// Title = "PnP Sample Contacts",
// Url = "lists/PnPContacts",
// TemplateType = (Int32)ListTemplateType.Contacts,
// EnableAttachments = true

web.ApplyProvisioningTemplate(template, ptai);


Stack Trace: 

at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectField.CreateField(Web web, XElement templateFieldElement, PnPMonitoredScope scope, TokenParser parser, String originalFieldXml)
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.ObjectField.ProvisionObjects(Web web, ProvisioningTemplate template, TokenParser parser, ProvisioningTemplateApplyingInformation applyingInformation)
at OfficeDevPnP.Core.Framework.Provisioning.ObjectHandlers.SiteToTemplateConversion.ApplyRemoteTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation provisioningInfo)
at Microsoft.SharePoint.Client.WebExtensions.ApplyProvisioningTemplate(Web web, ProvisioningTemplate template, ProvisioningTemplateApplyingInformation applyingInformation)
at PnPProvisioning.Program.ApplyProvisioningTemplateNew(ConsoleColor defaultForeground, String webUrl, String userName, SecureString pwd) in c:\Nabhendu\KNECT\PnPProvisioning\PnPProvisioning\Program.cs:line 211
at PnPProvisioning.Program.Main(String[] args) in c:\Nabhendu\KNECT\PnPProvisioning\PnPProvisioning\Program.cs:line 33
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()


I have uploaded my provisioning template also here. 


Anybody has some pointer please let me know.

Thanks in advance,


3 Replies

Hi, As per the xml the issue is happening at site columns level. can you verify the site columns which are created in the target site with the xml <pnp:SiteFields> section. I used to find the problematic column details in the above approach.

I would remove everything and build part per part back if you know which list something is missing incorrect and check the sitefields if they are provisioned correctly

The quickest way to debug this is by using the PowerShell commands. You can then simply enable debug and within no time you will know which field is causing the trouble: