我只想使用 power shell脚本
以编程方式在Web部件区域中添加Web部件我使用power shell脚本
获得此异常异常代码
$webPart = $webpartmanager.ImportWebPart($xmlReader, $errorMsg) -as [Microsoft.SharePoint.WebPartPages.WebPart] Argument: '2' should be a System.Management.Automation.PSReference. Use [ref]. + $webPart = $webpartmanager.ImportWebPart <<<< ($xmlReader, $errorMsg) -as [Microsoft.SharePoint.WebPartPages.WebPart] + CategoryInfo : NotSpecified: (:) [], MethodException + FullyQualifiedErrorId : NonRefArgumentToRefParameterMsg
答案 0 :(得分:0)
您是否尝试过错误消息的建议(请注意在[ref]
之前添加$errorMsg
)?
$webPart = $webpartmanager.ImportWebPart($xmlReader, [ref]$errorMsg)
-as [Microsoft.SharePoint.WebPartPages.WebPart]