【问题标题】:SharePoint Office365 Powershell Webpart AllItems.aspxSharePoint Office365 Powershell Webpart AllItems.aspx
【发布时间】:2020-11-07 02:04:36
【问题描述】:

使用 powershell,将 webpart(图像)添加到列表视图页面,例如AllItems.aspx.

当我将 webpart 添加到站点页面时,此代码是可以的,但是在列表中可以做什么/如何做同样的事情

$mySite = Get-PnPClientSidePage -Identity "TestWP.aspx"
$jsonProp = '{
        "imageSourceType":0,
        "imageSource":"https://MMMMMM.sharepoint.com/sites/pwa/SiteAssets/img01.jpg",
        "captionText":" ",
        "altText":" ",
        "linkUrl":"",
        "overlayText":"",
        "fileName":"",
        "siteId":"",
        "webId":"",
        "listId":"",
        "uniqueId":"",
        "imgWidth":"100%",
        "imgHeight":"100%"
        }'
Add-PnPClientSideWebPart -Page $mySite -Section 1 -Column 1 -Order 1 -DefaultWebPartType Image -WebPartProperties $jsonProp

【问题讨论】:

  • 欢迎来到 StackOverflow!您能否向我们提供有关您的问题的更多详细信息?

标签: powershell listview sharepoint office365 web-parts


【解决方案1】:

例如在 AllItems.aspx 视图中 -> 编辑页面 -> 插入 -> 图像 或添加 Web 部件。

链接中的示例。

img01 img02

【讨论】:

    【解决方案2】:

    咖啡,休息一下,我喝到了

    先手动添加一个webpart到测试页面,然后下载xml格式的webpart

    # get xml
    $imgWebPart = Get-PnPWebPartXml -ServerRelativePageUrl "/sites/pwa/Lists/TestList03/AllItems.aspx" -Identity "Image Viewer"
    
    Add-PnPWebPartToWebPartPage -ServerRelativePageUrl "/sites/pwa/Lists/TestList03/aa.aspx" -Xml $imgWebPart -ZoneId Main -ZoneIndex 0
    
    

    抱歉给您带来了困惑。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-11
      • 1970-01-01
      • 1970-01-01
      • 2011-07-10
      • 2013-08-29
      • 2010-10-09
      • 2014-12-10
      • 2011-11-01
      相关资源
      最近更新 更多