TransWikia.com

Add QuickLinks Webpart by using pnp powershell

SharePoint Asked by Abdelkader_AK on October 26, 2021

I’m trying to add quicklinks webpart with powershell. The webpart is created but the link is not displayed.

I managed to add many Web Parts using the minimum amount of Web Parts data, the json format complicates handling, but I am in trouble with the Quicklinks Web Part. Below is the code I tried using:

Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "QuickLinks" -WebPartProperties @{title="QuickLinksTest";items=@(@{id=1;title="Google";sourceItem=@{url="https://www.google.com"};description="Description 1";altText="altText 1"})}

Can anyone help with this please?

Thank you.

One Answer

I finally found the right minimum data to use to have the expected result:

Add-PnPClientSideWebPart -Page $page -DefaultWebPartType "QuickLinks" -WebPartProperties @{title="QuickLinks 2";items=@(@{sourceItem=@{url="https://www.google.com";itemType=2;fileExtension="";progId=""};title="Google";thumbnailType=3;id=2};@{sourceItem=@{url="https://www.youtube.com";itemType=2;fileExtension="";progId=""};title="Youtube";thumbnailType=3;id=1});hideWebPartWhenEmpty="true"}  

this code can be improved to add and manage display options.

Answered by Abdelkader_AK on October 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP