简体   繁体   English

如何使用 PnP PowerShell 获取所有 WebPart 数据/属性?

[英]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.

相关问题 PowerShell PnP 脚本循环遍历所有 WebPart 位置条款 - PowerShell PnP Script to loop thru all WebPart Location Terms 通过PowerShell为SharePoint网站上的每个页面获取所有Webpart属性 - Get all webpart properties via PowerShell for each page on a SharePoint site 如何使用 PnP PowerShell 修改内容类型中的字段属性? - How to modify field properties in content type using PnP PowerShell? 如何使用 PnP Powershell 删除所有列表项权限 - How to remove all list item permissions using PnP Powershell 我一直在尝试使用 pnp powershell 来获取 web 的所有用户并最终遇到 memory 异常 - I have been trying to use pnp powershell to get all the users of the web and end up having memory exception 如何使用 PnP PowerShell 检索大型 SharePoint 库中的所有列表项 - How to retrieve all list items in a large SharePoint library using PnP PowerShell 如何使用 pnp powershell 获取 SharePoint 在线列表中最后修改项目的项目 ID? - How to get item ID of the last modified item in the SharePoint online list using pnp powershell? SharePoint PnP PowerShell-从“选择”字段中获取选择 - SharePoint PnP PowerShell - Get choices from a Choice field PnP PowerShell - 我们可以在列表模板 xml 中获取列表内容吗? - PnP PowerShell - Can we get List content in List template xml? 获取 SharePoint 列表项中的附件文件大小 - PnP Powershell - Get the attachment file size in SharePoint list items - PnP Powershell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM