SOLVED

apply pnp template on sub site

Copper Contributor

Hi, 

I extracted a .pnp template from a sub site (publishing)  and then tried to apply that .pnp template to a newly created sub site (publishing) but I could not do this,

when I try to apply from power shell or C# console application it shows this error

 

applying absencevacationrequest template on a subsite of a Team site.png

I tried by downloading the pnp core source code and found that file stream is missing there, how can I solve this issue? Please help.

 

Here is a screenshot of powershell window

2016-10-29 15_53_08-Administrator_ Windows PowerShell ISE.png

 

 

15 Replies
It seems your Template is not in the right directory at least it can not find it in the directory you think it is. check the path and check if the template is in this location.
Hi, I double checked and the template is the desired directory. Any help?

@Vesa Juvonen Can you please help?

It is strange. It looks like the path does not exist. Did you check the template with the loaded schema if not working?

@Deleted I checked it is loaded when I tried to apply it from debug mode. It applies list instances and when it tries to apply Files (default.aspx) it fails

Ok that is another question. did you try to rename the default.aspx just to try it and remove the webparts..

 

@Deleted I did not rename anything.

 

Please see the following screen shots what I did (all using power shell)

Extracted template from site 

2016-10-31 12_57_23-Administrator_ Windows PowerShell ISE.png

 

Applying template started

Template applying startedTemplate applying started

Applying template fails

Applying template failsApplying template fails

 

I am attaching the .xml template file

Thanks

Hi,

 

looked at your template and what i would do narrow it down meaning remove parts of the xml like what happeens if all is commented out except time... etc..

 

furthermore i see this line:

<pnp:Property Key="PublishingPageLayout" Value="{sitecollection}/_catalogs/masterpage/wizdom2Column.aspx, https://xxxx.sharepoint.com/sites/rayhan{sitecollection}/_catalogs/masterpage/wizdom2Column.aspx" />

Wher you use a url and a sitecolleciton token in 1 url...

 

 

Thanks for your reply, my template works if I remove the whole Files section from the xml. But if I need to provision the files what should I do? Can you please let me know?

Thanks for your help
best response confirmed by Jess Lassen (Copper Contributor)
Solution

Hi,

 

it seems the pages are not in the current directory. My pnp:files look like this

<pnp:File src="SiteAssets\Logo.png" Folder="SiteAssets" Overwrite="true" />

where src could be C:\temp\sitesassets\logo.png

so whitout properties

 

but also do you need to provision the masterpages? If they are already in there why would you like to upload your version?

 

hope it helps.

Hi @Jess Lassen,

 

The easiest way to debug this is using PowerShell Set-SPOTraceLog.

 

https://veenstra.me.uk/2016/07/29/office-365-sharepoint-how-to-debug-pnp-provisioning-engine/

 

Thanks a lot for your help. When I modified file src from "default.aspx" to "Pages\default.aspx" it worked! I don't know why provisioning engine does not giving the correct path for file src. May be I am extracting template from sub site, that's why.

Anyway, thanks for the big help.
Thanks, I'll have a look into the article.

@Deleted one thing, I told you it works, but it only works from PowerShell but not from C# console application, can you give any clue? By the way, this time I am using .pnp template. 

Thanks

Hi Jess,

 

please make sure youre files are in the correct directory aka the bin directory where your console is running.

 

kr,

 

Paul

1 best response

Accepted Solutions
best response confirmed by Jess Lassen (Copper Contributor)
Solution

Hi,

 

it seems the pages are not in the current directory. My pnp:files look like this

<pnp:File src="SiteAssets\Logo.png" Folder="SiteAssets" Overwrite="true" />

where src could be C:\temp\sitesassets\logo.png

so whitout properties

 

but also do you need to provision the masterpages? If they are already in there why would you like to upload your version?

 

hope it helps.

View solution in original post