Forum Discussion
Jeremy GOUPIL
Aug 24, 2018Copper Contributor
Apply-PnPProvisioningTemplate : File not Found
Hello, I have a problem using Apply-PnPProvisioningTemplate with PowerShell on a SharePoint Online context. #website created to be used as a template Connect-PnPOnline -Url "https://$principalWe...
- AnonymousSep 17, 2018I've found the lines causing the Error:
After each List Instance, there is a Field "_DisplayName" that gets updated: the .xml looks like this:
<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 removed this Field Updates and was able to apply my template as I wanted. This bug seems to have been reported already (And fixes but not merged yet): https://github.com/SharePoint/PnP-Sites-Core/pull/1911
Sep 16, 2018
Maybe a link to the OneNote file on the left navigation? I've seen this as the cause of the problem multiple times
Anonymous
Sep 17, 2018I've found the lines causing the Error:
After each List Instance, there is a Field "_DisplayName" that gets updated: the .xml looks like this:
<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 removed this Field Updates and was able to apply my template as I wanted. This bug seems to have been reported already (And fixes but not merged yet): https://github.com/SharePoint/PnP-Sites-Core/pull/1911
After each List Instance, there is a Field "_DisplayName" that gets updated: the .xml looks like this:
<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 removed this Field Updates and was able to apply my template as I wanted. This bug seems to have been reported already (And fixes but not merged yet): https://github.com/SharePoint/PnP-Sites-Core/pull/1911
- Jeremy GOUPILSep 24, 2018Copper Contributor
So I have renamed srcTemplate.pnp to srcTemplate.zip
Extracted srcTemplate.zip
Edited this file : \Files\<guid>.xml
I have deleted :
<Field ID="{1a53ab5a-11f9-4b92-a377-8cfaaf6ba7be}" Name="_DisplayName" DisplaceOnUpgrade="TRUE" Sortable="FALSE" Filterable="FALSE" Hidden="FALSE" ReadOnly="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="{res:Field_Niveau_de_confidentialité_DisplayName}" 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" />
and<Field ID="{1a53ab5a-11f9-4b92-a377-8cfaaf6ba7be}" Name="_DisplayName" DisplaceOnUpgrade="TRUE" Sortable="FALSE" Filterable="FALSE" Hidden="FALSE" ReadOnly="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="{res:Field_Niveau_de_confidentialité_DisplayName}" 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" />
and<Field ID="{1a53ab5a-11f9-4b92-a377-8cfaaf6ba7be}" Name="_DisplayName" DisplaceOnUpgrade="TRUE" Sortable="FALSE" Filterable="FALSE" Hidden="FALSE" ReadOnly="TRUE" ShowInFileDlg="FALSE" Type="Lookup" DisplayName="{res:Field_Niveau_de_confidentialité_DisplayName}" 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" />
Zipped to srcTemplate.zip
Renamed to srcTemplate.pnpApply-PnPProvisioningTemplate : The Provisioning Template URI srcTemplate.xml is not valid.
- AnonymousSep 24, 2018Hi Jeremy,
Try to save your template to e.g. srcTemplate.xml and edit it in Visual Studio Code, or any other editor of your choice.
Don't forget to delete the lines just above, and below the field you removed before. Those are <pnp:Fields> and </pnp:Fields>
If i take one of your fields as example, you shoulde remove the following:
<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="{res:Field_Niveau_de_confidentialité_DisplayName}" 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>
Then save your xml file and use that to apply your template ;). You can also attach your xml file so that i can have a quick look at it for other inconsistencies- Jeremy GOUPILSep 24, 2018Copper Contributor
Okay sorry my mistake !
Its finally works... almost haha :)
I have created Home page with new experience but it is not keeped. Page file has been removed. But it is another problem. I gonna Google it.
Thanks a lot everybody !
- William HaywoodSep 24, 2018Copper Contributor
We ran into this issue with our c# provisioning system today as well and, as mentioned, solved by removing this field from the template:
var pnpTemplate = web.GetProvisioningTemplate(ptci);
foreach (var list in pnpTemplate.Lists)
{
list.Fields.RemoveAll(d => d.SchemaXml.Contains("_DisplayName"));
};