Forum Discussion
PnP Page Provisioning Images are not imported in the new provisioned site.
- Mar 31, 2020
Problem solved! thanks to the great Paolo Pialorsi , who provided us with the solution.
Sharing below the solution in case it can be useful in similar cases:1) First Export the client side page using the -PersistBrandingFiles attribute.
Export-PnPClientSidePage -Identity "TestPage.aspx" -Out .\single-page.xml -PersistBrandingFiles
2) Convert the xml and related content in an unique file pnp.
Convert-PnPFolderToProvisioningTemplate -Folder .\ -Out c:\temp\single-page.pnp3) Then connect to target site and apply the page provisioning.
Thanks Carlos for your time, and thank Paolo for the solution!
Cheers,
Alessio
Hi Carlos_Marins , thanks for your answer.
FYI when I provision a Site collection using a generated Site Template (.pnp) the images are correctly replaced, the issue I'm facing is only in the PnP Page Provisioning.
Hey 4lexius4 world , no problem.
So you're saying the images are being uploaded to the new site you provisioned, but it doesn't show in the page?
Did you generate the XML template?
- 4lexius4 worldMar 23, 2020Brass Contributor
Here is the xml file generated (easy page with image):
<pnp:Provisioning xmlns:pnp="http://schemas.dev.office.com/PnP/2020/02/ProvisioningSchema">
<pnp:Preferences Generator="OfficeDevPnP.Core, Version=3.18.2002.0, Culture=neutral, PublicKeyToken=5e633289e95c321a" />
<pnp:Templates ID="CONTAINER-TEMPLATE-E5234353766A42E1BDA63E0978BB736A">
<pnp:ProvisioningTemplate ID="TEMPLATE-E5234353766A42E1BDA63E0978BB736A" Version="0" Scope="Undefined">
<pnp:ClientSidePages>
<pnp:ClientSidePage PromoteAsNewsArticle="false" PromoteAsTemplate="false" Overwrite="true" Title="CoolPage" ThumbnailUrl="" PageName="CoolPage.aspx">
<pnp:Header Type="Custom" ServerRelativeImageUrl="{site}/SiteAssets/SitePages/CoolPage/92504-thumbnailAF.png" TranslateX="50.1305483028721" TranslateY="92.1428571428571" LayoutType="FullWidthImage" TextAlignment="Center" ShowTopicHeader="false" ShowPublishDate="false" TopicHeader="" AlternativeText="" Authors="[
 {
 "id": "i:0#.f|membership|alessio@stmdevelop.onmicrosoft.com",
 "upn": "Alessio@stmdevelop.onmicrosoft.com",
 "name": "4lexius4 world",
 "role": "O365 Expert"
 }
]" AuthorByLine="[
 "i:0#.f|membership|alessio@stmdevelop.onmicrosoft.com"
]" AuthorByLineId="-1" />
<pnp:Sections>
<pnp:Section Order="1" Type="OneColumn">
<pnp:Controls>
<pnp:CanvasControl WebPartType="Image" JsonControlData="{"id": "d1d91016-032f-456d-98a4-721247c305e8", "instanceId": "3ddf86b3-0dcc-46bf-a630-cf7fb0a4211e", "title": "Image", "description": "Show an image on your page", "dataVersion": "1.8", "properties": {"imageSourceType":2,"captionText":"","altText":"","linkUrl":"","overlayText":"","fileName":"cappello.jpg","siteId":"{sitecollectionid}","webId":"{siteid}","listId":"{listid:Site Assets}","uniqueId":"f30fd372-b76b-4ab4-97d6-c0b02d3c8966","imgWidth":736,"imgHeight":432,"alignment":"Center","fixAspectRatio":false}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{"imageSource":"{site}/SiteAssets/SitePages/CoolPage/69316-cappello.jpg"},"links":{},"customMetadata":{"imageSource":{"siteId":"{sitecollectionid}","webId":"{siteid}","listId":"{listid:Site Assets}","uniqueId":"f30fd372-b76b-4ab4-97d6-c0b02d3c8966","width":736,"height":432}}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="d1d91016-032f-456d-98a4-721247c305e8" Order="1" Column="1" />
<pnp:CanvasControl WebPartType="List" JsonControlData="{"id": "f92bf067-bc19-489e-a556-7fe95f508720", "instanceId": "68a40094-25b1-421a-98a5-50215c6fd281", "title": "Document library", "description": "Add a document library", "dataVersion": "1.0", "properties": {"isDocumentLibrary":true,"selectedListId":"{listid:Documents}","selectedListUrl":"{site}/Shared Documents","webRelativeListUrl":"/Shared Documents","webpartHeightKey":4}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{"listTitle":"Documents"},"imageSources":{},"links":{}}, "dynamicDataPaths": {}, "dynamicDataValues": {"filterBy":{}}}" ControlId="f92bf067-bc19-489e-a556-7fe95f508720" Order="2" Column="1" />
<pnp:CanvasControl WebPartType="News" JsonControlData="{"id": "8c88f208-6c77-4bdb-86a0-0c47b4316588", "instanceId": "de6a2463-87f0-47cd-b5e5-1dbefa6d6978", "title": "News", "description": "Display recent news.", "dataVersion": "1.11", "properties": {"carouselSettings":{"autoplay":false,"autoplaySpeed":5,"dots":true,"lazyLoad":true,"metadata":true,"swipe":true,"useStockItems":false},"showChrome":true,"showNewsMetadata":{"showSocialActions":true,"showAuthor":true,"showDate":true},"layoutId":"GridNews","prefetchCount":4,"filters":[{"filterType":1,"value":"","values":[]}],"newsDataSourceProp":1,"dataProviderId":"news","newsSiteList":[],"renderItemsSliderValue":4,"webId":"{siteid}","siteId":"{sitecollectionid}","pinnedItems":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"serializedFilterQuery":"<Where><Eq><FieldRef Name=\"FSObjType\" /><Value Type=\"Integer\">0</Value></Eq></Where>"}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{"baseUrl":"{hosturl}{site}"},"componentDependencies":{"layoutComponentId":"ef1147f9-e3f4-4844-b4fe-ab7e6c1f3a10"}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="8c88f208-6c77-4bdb-86a0-0c47b4316588" Order="3" Column="1" />
<pnp:CanvasControl WebPartType="Custom" JsonControlData="{"id": "62cac389-787f-495d-beca-e11786162ef4", "instanceId": "2afc723f-5ad0-48b1-a431-8442bc5c6403", "title": "Countdown Timer", "description": "This web part is used to allow a site admin to count down/up to an important event.", "dataVersion": "2.1", "properties": {"showButton":false,"countDate":"Fri Feb 21 2020 17:00:00 GMT+0100 (W. Europe Standard Time)","title":"","description":"","countDirection":"COUNT_DOWN","dateDisplay":"DAY_HOUR_MINUTE_SECOND","buttonText":"","buttonURL":""}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="62cac389-787f-495d-beca-e11786162ef4" Order="4" Column="1" />
<pnp:CanvasControl WebPartType="Custom" JsonControlData="{"id": "50256fc2-a28f-4544-900e-32724d32bc7f", "instanceId": "5a7dc925-9da5-4356-b813-10c8f5d01158", "title": "Stock Information", "description": "Stock information", "dataVersion": "1.0", "properties": {"demo":true,"stockSymbol":"STM","autoRefresh":true}, "serverProcessedContent": {"htmlStrings":{},"searchablePlainTexts":{},"imageSources":{},"links":{}}, "dynamicDataPaths": {}, "dynamicDataValues": {}}" ControlId="50256fc2-a28f-4544-900e-32724d32bc7f" Order="5" Column="1" />
</pnp:Controls>
</pnp:Section>
</pnp:Sections>
</pnp:ClientSidePage>
</pnp:ClientSidePages>
</pnp:ProvisioningTemplate>
</pnp:Templates>
</pnp:Provisioning>- Carlos_MarinsMar 25, 2020Iron Contributor
Hey 4lexius4 world ,
In this case, I think you need to download the image you're using as a Banner for the page - with the name "92504-thumbnailAF.png", keep it in the same directory as your XML, and add the following code after "</pnp:ClientSidePages>":
<pnp:Files>
<pnp:File src="./92504-thumbnailAF.png" Folder="SiteAssets/SitePages/CoolPage" Overwrite="true" Level="Published" />
</pnp:Files>- 4lexius4 worldMar 31, 2020Brass Contributor
Problem solved! thanks to the great Paolo Pialorsi , who provided us with the solution.
Sharing below the solution in case it can be useful in similar cases:1) First Export the client side page using the -PersistBrandingFiles attribute.
Export-PnPClientSidePage -Identity "TestPage.aspx" -Out .\single-page.xml -PersistBrandingFiles
2) Convert the xml and related content in an unique file pnp.
Convert-PnPFolderToProvisioningTemplate -Folder .\ -Out c:\temp\single-page.pnp3) Then connect to target site and apply the page provisioning.
Thanks Carlos for your time, and thank Paolo for the solution!
Cheers,
Alessio