Forum Discussion
PnP PowerShell error: Apply-PnPProvisioningTemplate : File Not Found
- Oct 17, 2018
Removing those lines did in fact fix the issue. My script isn't ready, though, because the PowerShell I wrote to automatically change the contents of the PNP file isn't working.
For now, the solution to the issue reported in the OP is to remove the <PNP:Field> elements where ID = 1a53ab5a-11f9-4b92-a377-8cfaaf6ba7be.
When I remove those elements by hand, the template works. Now I need to get my script to automatically fix the template working, but that's a topic for another thread.
Could it be that the file is in another directory then the one you are running your script from? and do you run it under Admin credentials?
- Brandon MurrayOct 17, 2018Brass Contributor
I am running as admin, and the script is just typed into the ISE right now, I haven't saved it. I don't think that would be a factor, though, since I've typed the full path to the template into the -Out/-Path parameters.
However, I have made one new discovery... Just discovered the "-debug" switch on the Apply cmdlet, which pauses the script when an error occurs. In conjunction with the nice status bar, this showed me that the part of the template that's causing the issue is:
<pnp:Fields> <Field ID="{1a53ab5a-11f9-4b92-a377-8cfaaf6ba7be}" Name="_DisplayName" DisplaceOnUpgrade="TRUE" Sortable="FALSE" Filterable="FALSE" Hidden="FALSE" ReadOnly="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="Sensitivity" List="Docs" ListInternal="IpLabelCache" FieldRef="LabelId" ShowField="DisplayName" LeftList="Docs" LeftColumnName="IpLabelId" JoinColName="LabelId" JoinRowOrdinal="0" JoinType="LEFT OUTER" SchemaVersion="16.0.162.0" RecreateIfMissing="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="_DisplayName" FromBaseType="TRUE" /> </pnp:Fields>
I'm going to try removing that from the XML file manually, but if that works that's only a partial solution. I'm writing a script that a client can "fire and forget," so everything needs to be done in the script, ultimately.
- Brandon MurrayOct 17, 2018Brass Contributor
Removing those lines did in fact fix the issue. My script isn't ready, though, because the PowerShell I wrote to automatically change the contents of the PNP file isn't working.
For now, the solution to the issue reported in the OP is to remove the <PNP:Field> elements where ID = 1a53ab5a-11f9-4b92-a377-8cfaaf6ba7be.
When I remove those elements by hand, the template works. Now I need to get my script to automatically fix the template working, but that's a topic for another thread.