【问题标题】:I want to add web part in web part zone using powershell script我想使用 powershell 脚本在 web 部件区域中添加 web 部件
【发布时间】:2011-09-07 18:33:45
【问题描述】:

我想仅使用 power shell 脚本

以编程方式在 Web 部件区域中添加 Web 部件

我在使用 power shell 脚本时遇到了这个异常

异常代码

$webPart = $webpartmanager.ImportWebPart($xmlReader, $errorMsg) -as [Microsoft.SharePoint.WebPartPages.WebPart] 参数:“2”应该是 System.Management.Automation.PSReference。使用[参考]。 + $webPart = $webpartmanager.ImportWebPart

【问题讨论】:

    标签: sharepoint powershell web-parts


    【解决方案1】:

    您是否尝试过错误消息的提示(注意在$errorMsg 之前添加了[ref])?

    $webPart = $webpartmanager.ImportWebPart($xmlReader, [ref]$errorMsg)
                   -as [Microsoft.SharePoint.WebPartPages.WebPart]
    

    【讨论】:

      猜你喜欢
      • 2010-09-07
      • 1970-01-01
      • 2021-07-01
      • 2020-09-20
      • 2014-10-19
      • 2011-05-20
      • 2010-10-06
      • 2011-07-07
      • 2010-09-24
      相关资源
      最近更新 更多