Forum Discussion
David Moore
Sep 29, 2016Copper Contributor
OfficeDev PnP - Provision Page content?
I know there's a <pnp:Pages> element in the schema, but it seems to only provision web part XML. Is there any way to add just HTML to a wiki page content, rather than having to wrap it in a Content Editor Web Part?
Cheers!
David,
What you could do is use a current team site, with a wiki page as welcome page. Add some text/html to this page and use below powershell command to extract this site as template:
Connect-SPOnline -Url "Url to your team site"
Get-SPOProvisioningTemplate -Out "C:\temp\teamsite.xmlWithin the extracted template, lookup your page (pnp:Pages element). Within the page there should be a Field called 'WikiField'. Your html is in here. So to put html in a page and provision it within a template: put it in this field.
<pnp:Field FieldName="WikiField"><![CDATA[<div class="ExternalClass972799D44F734918B33EB6504C516F27"><table id="layoutsTable" style="width:100%;"><tbody><tr style="vertical-align:top;"><td style="width:100%;"><div class="ms-rte-layoutszone-outer" style="width:100%;"><div class="ms-rte-layoutszone-inner" style="min-height:420px;"><p>This is some test <strong>text.</strong><br></p></div></div></td></tr></tbody></table><span id="layoutsData" style="display:none;">false,false,1</span></div>]]></pnp:Field>
- Deletedeven better to use it without the webpart thanks Robert Schouten
- Deleted
you could do it like this:
<pnp:WebPart Column="1" Row="1" Title="Script Editor"> <pnp:Contents> <webParts> <webPart xmlns="http://schemas.microsoft.com/WebPart/v3"> <metaData> <type name="Microsoft.SharePoint.WebPartPages.ScriptEditorWebPart, Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <importErrorMessage>Cannot import this Web Part.</importErrorMessage> </metaData> <data> <properties> <property name="ExportMode" type="exportmode">All</property> <property name="HelpUrl" type="string" /> <property name="Hidden" type="bool">False</property> <property name="Description" type="string">Allows authors to insert HTML snippets or scripts.</property> <property name="Content" type="string"> Add some project info here.<br /><br /> <div style="float:left; width:150px; padding-right:12px;"> <div > <a href="{SiteCollection}/TEN" title="test"> <img width="150" height="124" src="{SiteCollection}/SiteAssets/Tiles/test.jpg"/> </a> </div> <div> <a href="{SiteCollection}/TEN" title="test"> <h2 style="text-align:center;">test</h2> </a> </div> </div> <div style="float:left; width:150px; padding-right:12px;"> <div > <a href="{SiteCollection}/EXE" title="Execution"> <img width="150" height="124" src="{SiteCollection}/SiteAssets/Tiles/EXE.jpg"/> </a> </div> <div> <a href="{SiteCollection}/EXE" title="test"> <h2 style="text-align:center;">test</h2> </a> </div> </div> <div style="float:left; width:150px; padding-right:12px;"> <div > <a href="{SiteCollection}/CLO" title="test"> <img width="150" height="124" src="{SiteCollection}/SiteAssets/Tiles/test.jpg"/> </a> </div> <div> <a href="{SiteCollection}/CLO" title="test"> <h2 style="text-align:center;">test</h2> </a> </div> </div> </property> <property name="CatalogIconImageUrl" type="string" /> <property name="Title" type="string">Script Editor</property> <property name="AllowHide" type="bool">True</property> <property name="AllowMinimize" type="bool">True</property> <property name="AllowZoneChange" type="bool">True</property> <property name="TitleUrl" type="string" /> <property name="ChromeType" type="chrometype">None</property> <property name="AllowConnect" type="bool">True</property> <property name="Width" type="unit" /> <property name="Height" type="unit" /> <property name="HelpMode" type="helpmode">Navigate</property> <property name="AllowEdit" type="bool">True</property> <property name="TitleIconImageUrl" type="string" /> <property name="Direction" type="direction">NotSet</property> <property name="AllowClose" type="bool">True</property> <property name="ChromeState" type="chromestate">Normal</property> </properties> </data> </webPart> </webParts> </pnp:Contents> </pnp:WebPart>