[英]How to get all WebPart data / properties with PnP PowerShell?
I'm trying to get all WebPart data/ properties on a SharePoint page using PnP PowerShell.我正在尝试使用 PnP PowerShell 获取 SharePoint 页面上的所有 WebPart 数据/属性。
First I'm getting the page with:首先,我得到的页面是:
$page = Get-PnPClientSidePage "de/test2.aspx"
Then check the controls on the page:然后检查页面上的控件:
$page.Controls
InstanceId Type Title Section Column Position PropertiesJson
---------- ---- ----- ------- ------ -------- --------------
0e3f7654-f18d-4df5-9401-ae7f47c9ad7d PageText 1 1 1
3dea7c8a-3eec-4189-b96b-81b2474aa6a0 PageWebPart Image 1 2 1 {"imageSourceType":2,"altText":"Dies ist der alternative Text.","linkUrl":"","overlayText":"Dies ist der überlagerte …
8c4315ac-6803-4753-83ac-18c9eb00cbf0 PageText 2 1 1
604b4f67-0a14-4174-9945-ac53f3c7c6c4 PageWebPart Quick links 2 1 2 {"items":[{"sourceItem":{"itemType":2,"fileExtension":"","progId":""},"thumbnailType":3,"id":2,"description":"","altT…
f2da7eff-d8f8-48a0-a667-e258023af088 PageWebPart Button 2 2 1 {"alignment":"Left"}
4fa743ae-5899-4f29-9647-3c6f86438050 PageWebPart Call to action 2 2 2 {"image":{"zoomRatio":1},"button":{"linkUrl":""},"overlayText":{},"alignment":"Left"}
cf321c08-0b57-4d2f-bdc4-f3d6cd90d157 PageWebPart Link 2 2 3 {"linkPreviewComponentMode":0,"displayLink":true,"cachedMetaDataUpdateTimeStamp":1657099833637,"listId":"","webId":""…
c04c7873-dd7a-4fca-bfb3-722b8e4da916 PageWebPart Hero 3 1 1 {"heroLayoutThreshold":640,"carouselLayoutMaxWidth":639,"layoutCategory":1,"layout":2,"content":[{"id":"baf0df3e-3fa1…
06c21f0a-159f-4a19-bdb2-3444250bda0a PageWebPart Image gallery 3 1 2 {"layout":1,"carouselSettings":{"autoplay":false,"autoplaySpeed":5,"dots":false,"lazyLoad":true,"metadata":true,"swip…
The problem is, that not all components include all information of the WebPart in die PropertiesJson.问题是,并非所有组件都在 PropertiesJson 中包含 WebPart 的所有信息。 For example the Button WebPart properties only contain the alignment info, but of course the button also contains a label and a link.例如,Button WebPart 属性仅包含对齐信息,但当然该按钮还包含标签和链接。 Same problem happens with the Quick Links, Call to action, Link, Hero and Image gallery WebPart.快速链接、号召性用语、链接、英雄和图片库 WebPart 也会出现同样的问题。
Is there a way to get all properties from a WebPart?有没有办法从 WebPart 获取所有属性?
Thanks in advance!提前致谢!
Regards Alex问候亚历克斯
You can use the following command to get Web Part property:您可以使用以下命令获取 Web 部件属性:
Get-PnPWebPartProperty -ServerRelativePageUrl /sites/xxx/sitepages/xxx.aspx -Identity xxxxxx
For reference: Get-PnPWebPartProperty供参考: Get-PnPWebPartProperty
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.