I would like to present a document library on the home page (default.aspx
) of a classic SPO site.
What I would do with hand is to edit the page - add web part - apps - select the document library.
I exported this web part, added a few placeholders to the dynamic properties and I am able to add it to a new site, but I have difficulties with one property:
<property name="ListName" type="string">#ListID#</property>
Now, I can query the list id with
$listid = (Get-PnPList | where {$_.Title -eq $listname}).ID
and substitute the #ListID#
placeholder in the xml, but isn't there any better way to achieve this, without extra rounds? Can I maybe put this in the provisioning template?
Edit: Site provisioning done like:
New-PnPWeb -Title $Title -Url $SubSiteUrl -Template $Template -InheritNavigation #default STS#0
Connect-PnPOnline $url -Credentials $credential
Apply-PnPProvisioningTemplate -Path $template
The "Document" library is made by the default STS#0 template, I don't see, how I could get the library ID. The PnP template is almost empty.
<property name="ListName" type="string">{{listid:Documents}}</property>
and it will work, did you try this ?Add-PnPWebPartToWebPartPage -ServerRelativePageUrl $page -Path $webpart -ZoneId $zone -ZoneIndex $index
I get a List does not exist. error.PnPWebPartToWebPartPage
command as it is a standalone commandlet and not part of provisioning engine