Forum Discussion
Darren Parkinson
Sep 26, 2017Brass Contributor
Adding People to the People Web Part Programmatically (using PowerShell maybe?)
There doesn't seem to be any documentation relating to the modern web part components. I can add a modern web part component to the page like this: Add-PnPClientSideWebPart -Page $home -Defau...
- Sep 26, 2017
Hi Darren Parkinson,
I ran Get-PnPProvisioning Template before adding a people web part
Then I added a people web part and then ran Get-PnPProvisioningTemplate again
The difference is :
<pnp:CanvasControl WebPartType="People" JsonControlData="{"layout":1,"persons":[{"id":"i:0#.f|membership|pieter@mytenant.onmicrosoft.com","role":""}]}" ControlId="7f718435-ee4d-431c-bdbf-9c4ff326f46e" Column="1" />On the Add-PnPClientSideWebPart I couldn't find anything to add the data, but you could create a template whcih just includes the above webpart details and then add the web part with Apply-ProvisioningTemplate.
Sep 26, 2017
Hi Darren Parkinson,
I ran Get-PnPProvisioning Template before adding a people web part
Then I added a people web part and then ran Get-PnPProvisioningTemplate again
The difference is :
<pnp:CanvasControl WebPartType="People" JsonControlData="{"layout":1,"persons":[{"id":"i:0#.f|membership|pieter@mytenant.onmicrosoft.com","role":""}]}" ControlId="7f718435-ee4d-431c-bdbf-9c4ff326f46e" Column="1" />
On the Add-PnPClientSideWebPart I couldn't find anything to add the data, but you could create a template whcih just includes the above webpart details and then add the web part with Apply-ProvisioningTemplate.
Darren Parkinson
Sep 27, 2017Brass Contributor
Interesting that it's only adding the JsonControlData field which is what I've be trying to do via PowerShell. I'll give it another go with that before giving up.