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
Aug 24, 2018
A common solution to that error is to open the template file look for the File references and ensure that all those files are available on the relative location where your template is located.
For example, if you have a <pnp:File> element referencing a file on "/MyFilesExample/MyFile.txt", next to the template file you will need a "MyFilesExample" folder and inside that folder a "MyFile.txt".
This happens in some scenarios, but it's generally easy to fix as you can just create the required folders and download the required files from the original site that was used as a template.
Note: I have assumed that you are doing this in 2 steps
- create site and save template
("fix" template)
- create site and apply template
Hope this helps
Aug 31, 2018
Jeremy GOUPIL just checked your template and I think it's the OneNote reference on navigation.
<pnp:NavigationNode Title="Bloc-notes" Url="{site}/_layouts/15/WopiFrame.aspx?sourcedoc={137c43e8-57b9-4f2f-a6ba-0d50fa98c1c5}&action=editnew" IsExternal="true" />
Try removing this line and try again as it should work
- Jeremy GOUPILSep 24, 2018Copper Contributor
Hello,
I have already deleted the OneNote file from my website before creating the template. I have even deleted the file from the site's bin. And the link in the navigation bar has been deleted too. This is not my problem :/ - AnonymousSep 16, 2018
I'm experiencing the same issue: tried about everything but don't know why I always get this error:
PowerShell_ISE.exe Information: 0 : 2018-09-16 22:45:56.6430 [Provisioning] [14] [Debug] Code execution scope ended 107192ms 656c838b-f844-4709-b8fb-2372ae42169f
Apply-PnPProvisioningTemplate : File Not Found.
At line:3 char:1
+ Apply-PnPProvisioningTemplate -Path "C:\temp\PatrimoniumTeamSiteTempl ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : WriteError: (:) [Apply-PnPProvisioningTemplate], ServerException
+ FullyQualifiedErrorId : EXCEPTION,SharePointPnP.PowerShell.Commands.Provisioning.ApplyProvisioningTemplateI don't think I'm referencing to any document in the provisioning xml.
xml file in the attachments
- Sep 16, 2018Maybe a link to the OneNote file on the left navigation? I've seen this as the cause of the problem multiple times
- 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